how-we-feel Svelte Themes

How We Feel

A full-stack web application for tracking, storing and managing user emotions

Emotion Tracking Web Application

A full-stack web application for tracking, storing, and managing user emotions securely over time.

Built using Svelte, Node.js (Express), and PostgreSQL, deployed on Azure with Nginx as a reverse proxy and PM2 for process management.


Features

  • User authentication
  • Session-based authentication
  • Emotion logging with color tagging
  • Retrieve emotion history per user
  • Manage active sessions (view, revoke single session, revoke all)
  • Cross-origin support with secure CORS configuration
  • Scalable backend with database abstraction

Architecture Overview


Tech Stack

  • Frontend: Svelte + JavaScript
  • Backend: NodeJS + ExpressJS
  • Database: PostgreSQL
  • Deployment & Infrastructure: Azure VM - Nginx & PM2

Project Structure

├── public/                  # Static assets
├── src/
│   ├── components/  # Reusable UI components
│   └── Screens/         # Application screens/pages
├── app.js                   # Express backend
├── index.html
├── .env
├── .gitignore             # Ignore build files and node_modules
├── Dockerfile
└── docker-compose.yml

Environment Variables

Create a .env file in the backend root:

FRONTEND_URL=http://localhost:5173
DATABASE_URL=postgresql://user:password@host:port/dbname
MONGO_URL=mongodb://localhost:27017/dbname

Running Locally

Backend

npm install
node index.js

Backend runs on:

http://localhost:3000

Frontend

npm install
npm run dev

Authentication Flow

  1. User signs up → password hashed using bcrypt
  2. User logs in → credentials verified
  3. Server creates session token
  4. Token stored as HTTP-only cookie
  5. Protected routes validate session

API Endpoints

Endpoint Method Description
/signin POST Create user
/login POST Login user
/save POST Save emotion
/data POST Fetch emotions
/logout POST Logout current session
/sessions POST View active sessions
/revoke POST Revoke one session
/revokeAll POST Revoke all sessions

Security

  • Password hashing with bcrypt
  • HTTP-only cookies for sessions
  • CORS configured with credentials
  • Designed to support HTTPS with SSL/TLS via Nginx

Future Improvements

  • Emotion analytics & visualization
  • Neo4j for social emotion sharing graph

Top categories

Loading Svelte Themes