βSharing happiness, one thought at a time.β
A joyful mini social feed built with React, Vite, and styled-components.
Happy Thoughts lets users post short positive messages, like othersβ posts, and spread a bit of joy β now backed by a custom REST API with authentication.
π Live demo: https://thinkhappy.netlify.app
- Fullstack development from UI to database
- Authentication and authorization with JWT
- Ownership-based permissions
- Accessibility-conscious UI decisions
- Deployment of both frontend and backend
- π¬ Post short thoughts (5β140 characters)
- β€οΈ Like thoughts (authentication required)
- π See how long ago each thought was posted
- π Sign up and log in with username + password
- π§Ύ JWT-based authentication (stored in localStorage)
- βοΈ Edit and ποΈ delete your own thoughts
- ποΈ Conditional UI (edit/delete only visible for owner)
- π§ Mock mode for offline development
- π‘ Clean, responsive, and accessible design
- π Deployed frontend on Netlify, backend on Render
| Technology | Purpose |
|---|---|
| βοΈ React (Vite) | Frontend framework |
| π styled-components | Component-scoped styling |
| π§ React Context | Authentication state |
| π Fetch API | Backend communication |
| π§© Express + MongoDB | Custom REST API |
| π JWT | Authentication |
| βοΈ Netlify | Frontend hosting |
| βοΈ Render | Backend hosting |
The app includes a full authentication flow:
- Sign up with username and password
- Log in to receive a JWT token
- Token is stored in
localStorage - Protected actions:
- Create thought
- Like thought
- Edit own thought
- Delete own thought
Logged-out users can still read thoughts.
This app uses a custom-built Happy Thoughts API.
Base URL:
https://js-project-api-j7vv.onrender.com
| Method | Endpoint | Description |
|---|---|---|
| POST | /auth/signup |
Create new user |
| POST | /auth/login |
Log in user |
| Method | Endpoint | Description |
|---|---|---|
| GET | /thoughts |
Fetch latest thoughts |
| POST | /thoughts |
Create new thought (auth required) |
| POST | /thoughts/:id/like |
Like a thought (auth required) |
| PATCH | /thoughts/:id |
Edit own thought |
| DELETE | /thoughts/:id |
Delete own thought |
-
Install dependencies
npm install
-
Start the app locally
npm run dev
Runs at http://localhost:5173
-
Build for production
npm run build
-
Preview production build
npm run preview
When the backend API is unavailable, you can enable mock data:
// src/services/apiBase.js
export const USE_MOCK = true;- Build command:
npm run build - Publish directory:
dist - No proxy or redirects required
- Node + Express API
- MongoDB database
- JWT authentication
- Environment variables handled via Render dashboard
| Device | Behavior |
|---|---|
| π± Mobile | Stacked layout, large tap targets |
| π» Tablet | Balanced spacing |
| π₯οΈ Desktop | Centered container with max-width |
β Semantic HTML
β Keyboard-accessible buttons and forms
β Visible focus states
β High color contrast
β ARIA labels for icon buttons
- π Track unique likes per user
- π Animations for posting and liking
- π Empty-state UI
- π Dark mode toggle
Built with π, β, curiosity, and persistence by
Ulrika Einerbrant
Frontend developer passionate about accessible, joyful user experiences.
π Live app: https://thinkhappy.netlify.app
π» GitHub repo: https://github.com/UlrikaRakkaBrant/js-project-happy-thoughts
π§ Portfolio: https://ulrikasportfolio.netlify.app
πΌ LinkedIn: https://www.linkedin.com/in/ulrika-einerbrant/
MIT License
