Skip to content

adelicia-js/todo-vite-fs

Repository files navigation

πŸ“ Full-Stack Todo Application

A modern, production-ready todo application built with React, TypeScript, Node.js, and SQLite. Features user authentication, pagination, real-time CRUD operations, and a beautiful notebook-style responsive design.

✨ Features

  • πŸ” User Authentication - Secure JWT-based login/register system with token validation
  • πŸ“ CRUD Operations - Create, read, update, delete todos with optimistic UI updates
  • ✏️ Inline Editing - Edit todos directly with save/cancel options
  • πŸ“„ Pagination - Smart pagination with 6 todos per page and intuitive navigation
  • 🎨 Notebook Design - Beautiful notebook-style UI with spiral binding and lined paper
  • πŸ“± Responsive Design - Fully responsive across all devices (360px to desktop)
  • πŸ”„ Real-time Updates - Changes persist instantly with optimistic updates
  • πŸ’« Modern UX - Loading states, error handling, and smooth transitions
  • πŸ›‘οΈ Secure - Password hashing, token expiration, CORS protection
  • πŸš€ Production Ready - Environment variables, error handling, deployment configs

πŸ—οΈ Tech Stack

Frontend

  • React 19.1.1 with TypeScript
  • Vite 7.1.0 for fast development and building
  • styled-components 6.1.19 for CSS-in-JS styling
  • Axios with interceptors for API communication
  • Kalam & Caveat fonts for handwritten notebook aesthetic

Backend

  • Node.js with Express.js framework
  • TypeScript for type safety
  • Prisma ORM with SQLite database
  • JWT for authentication
  • bcryptjs for password hashing
  • CORS for cross-origin requests

πŸš€ Quick Start

Prerequisites

  • Node.js 18+ installed
  • npm or yarn package manager

1. Clone & Install

git clone https://github.com/yourusername/todo-vite-fs.git
cd todo-vite-fs

# Install frontend dependencies
npm install

# Install backend dependencies
cd todo-backend
npm install

2. Setup Environment Variables

# Root directory - create .env
echo "VITE_API_URL=http://localhost:3001" > .env

# Backend directory - create .env
cd todo-backend
echo "DATABASE_URL=\"file:./prisma/dev.db\"
JWT_SECRET=\"your-super-secure-jwt-secret-change-this\"
NODE_ENV=\"development\"
PORT=3001
FRONTEND_URL=\"http://localhost:5173\"" > .env

3. Setup Database

# In todo-backend directory
npx prisma generate
npx prisma db push

4. Run the Application

Terminal 1 - Backend:

cd todo-backend
npm run dev

Terminal 2 - Frontend:

npm run dev

Visit http://localhost:5173 and start creating todos! πŸŽ‰

πŸ“ Project Structure

todo-vite-fs/
β”œβ”€β”€ src/                          # Frontend source code
β”‚   β”œβ”€β”€ components/
β”‚   β”‚   β”œβ”€β”€ Auth.tsx             # Authentication component
β”‚   β”‚   β”œβ”€β”€ TodoInput.tsx        # Todo input component
β”‚   β”‚   β”œβ”€β”€ TodoList.tsx         # Todo list component
β”‚   β”‚   └── Footer.tsx           # Footer component
β”‚   β”œβ”€β”€ services/
β”‚   β”‚   └── api.ts               # API service layer with interceptors
β”‚   β”œβ”€β”€ types/
β”‚   β”‚   └── index.ts             # TypeScript type definitions
β”‚   └── App.tsx                  # Main application with pagination
β”œβ”€β”€ todo-backend/                # Backend source code
β”‚   β”œβ”€β”€ src/
β”‚   β”‚   β”œβ”€β”€ controllers/         # Business logic
β”‚   β”‚   β”œβ”€β”€ middleware/          # Authentication middleware
β”‚   β”‚   β”œβ”€β”€ routes/              # API routes
β”‚   β”‚   └── server.ts            # Express server
β”‚   β”œβ”€β”€ prisma/
β”‚   β”‚   β”œβ”€β”€ schema.prisma        # Database schema
β”‚   β”‚   └── dev.db              # SQLite database
β”‚   └── package.json
β”œβ”€β”€ DEPLOYMENT.md               # Production deployment guide
└── README.md

🎯 API Endpoints

Authentication

  • POST /auth/register - Create new user account
  • POST /auth/login - User login

Todos (Protected Routes)

  • GET /api/todos - Get paginated user todos
  • POST /api/todos - Create new todo
  • PUT /api/todos/:id - Update specific todo
  • DELETE /api/todos/:id - Delete specific todo

Health Check

  • GET /health - Server health status

πŸ› οΈ Available Scripts

Frontend Scripts

npm run dev          # Start development server
npm run build        # Build for production
npm run preview      # Preview production build
npm run lint         # Run ESLint

Backend Scripts

npm run dev          # Start development server with nodemon
npm run build        # Build TypeScript and generate Prisma client
npm start            # Start production server
npm run deploy       # Full deployment script

πŸš€ Production Deployment

This application is ready for deployment on platforms like Vercel, Railway, or Heroku.

Quick Vercel Deployment:

  1. Push to GitHub
  2. Import repository to Vercel (twice - once for frontend, once for backend)
  3. Set environment variables
  4. Deploy!

πŸ” Security Features

  • βœ… JWT tokens with 24-hour expiration
  • βœ… Password hashing with bcrypt (salt rounds: 10)
  • βœ… CORS protection configured for specific origins
  • βœ… Request validation and error handling
  • βœ… Environment variables for sensitive data
  • βœ… No sensitive data exposed to frontend

🎨 Design System

Notebook Aesthetic

  • Color Palette: Warm paper tones (#f5f1e8, #f0ebe0) with blue accents (#1e40af)
  • Typography: Kalam (cursive) and Caveat fonts for handwritten feel
  • Layout: Spiral binding, red margin line, ruled paper background
  • Components: Rotated elements for natural handwritten appearance

Responsive Design

  • Desktop: Full notebook with margins and spiral binding
  • Tablet (768px): Adjusted spacing and positioning
  • Mobile (480px): Optimized padding and font sizes
  • Small Mobile (360px): Full-screen layout with minimal margins

Interactive Elements

  • Hover Effects: Rotation and color transitions
  • Touch Targets: Minimum 44px for mobile accessibility
  • Loading States: Smooth transitions and visual feedback

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit changes (git commit -m 'Add amazing feature')
  4. Push to branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Built with modern React and Node.js best practices
  • Inspired by clean, minimalist design principles
  • Uses industry-standard authentication and security patterns

Made with πŸ’– by Adelicia Sequeira

Releases

No releases published

Packages

No packages published