Skip to content
Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

81 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ’– Happy Thoughts

β€œ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


πŸ–ΌοΈ Preview

Happy Thoughts app screenshot


What This Project Shows

  • Fullstack development from UI to database
  • Authentication and authorization with JWT
  • Ownership-based permissions
  • Accessibility-conscious UI decisions
  • Deployment of both frontend and backend

✨ Features

  • πŸ’¬ 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

🧠 Tech Stack

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

πŸ” Authentication

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.


πŸ”— API

This app uses a custom-built Happy Thoughts API.

Base URL:
https://js-project-api-j7vv.onrender.com

Auth routes

Method Endpoint Description
POST /auth/signup Create new user
POST /auth/login Log in user

Thought routes

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

πŸͺ„ Getting Started

  1. Install dependencies

    npm install
  2. Start the app locally

    npm run dev

    Runs at http://localhost:5173

  3. Build for production

    npm run build
  4. Preview production build

    npm run preview

πŸ§ͺ Mock Mode (Offline Development)

When the backend API is unavailable, you can enable mock data:

// src/services/apiBase.js
export const USE_MOCK = true;

πŸš€ Deployment

Frontend (Netlify)

  • Build command: npm run build
  • Publish directory: dist
  • No proxy or redirects required

Backend (Render)

  • Node + Express API
  • MongoDB database
  • JWT authentication
  • Environment variables handled via Render dashboard

πŸ“± Responsiveness

Device Behavior
πŸ“± Mobile Stacked layout, large tap targets
πŸ’» Tablet Balanced spacing
πŸ–₯️ Desktop Centered container with max-width

β™Ώ Accessibility

βœ” Semantic HTML
βœ” Keyboard-accessible buttons and forms
βœ” Visible focus states
βœ” High color contrast
βœ” ARIA labels for icon buttons


πŸͺ΄ Stretch Goals / Future Improvements

  • 🌟 Track unique likes per user
  • 🌟 Animations for posting and liking
  • 🌟 Empty-state UI
  • 🌟 Dark mode toggle

πŸ‘©β€πŸ’» Author

Built with πŸ’–, β˜•, curiosity, and persistence by
Ulrika Einerbrant

Frontend developer passionate about accessible, joyful user experiences.


πŸ’« Connect

πŸ”— 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/


πŸͺΆ License

MIT License

About

πŸ’– A cheerful mini social app built with React + Vite where users can share happy thoughts, send hearts, and spread positivity.

Topics

Resources

Stars

Watchers

Forks

Releases

Contributors

Languages