A full-stack Progressive Web Application (PWA) built with Next.js, Express, and PostgreSQL for managing tasks with offline capabilities.
- Next.js 16 - React framework with Turbopack for fast development
- Progressive Web App (PWA) - Installable on desktop and mobile devices
- Dark Mode Support - Theme switching with next-themes
- Responsive UI - Built with Tailwind CSS and Radix UI components
- Real-time Notifications - Toast notifications using Sonner
- Online/Offline Detection - Visual indicator for connection status
- Local Storage - Persistent user session management
- Express.js - REST API server
- PostgreSQL (Neon) - Cloud-hosted serverless database
- Drizzle ORM - Type-safe database operations
- CORS Enabled - Cross-origin resource sharing support
- Error Handling - Comprehensive error management and logging
- Users Table
- UUID (Primary Key)
- Username
- Created At (Timestamp)
- Tasks (JSON)
POST /api/users- Create or ensure user existsGET /api/users/:uuid- Get user by UUID
GET /api/users/:uuid/tasks- Get all tasks for a userPOST /api/users/:uuid/tasks- Add a new taskPUT /api/users/:uuid/tasks- Update all tasksPATCH /api/users/:uuid/tasks/:taskId/status- Update task status
GET /api/health- Server health status
Frontend:
- Next.js 16.0.10
- React 19.2.1
- TypeScript 5
- Tailwind CSS 4
- Radix UI Components
- Lucide Icons
Backend:
- Express.js
- Drizzle ORM 0.45.1
- Neon Serverless PostgreSQL
- CORS
Development:
- Bun Runtime
- Drizzle Kit (Database Migrations)
- ESLint
- Clone the repository
git clone <repository-url>
cd progressive-web-app- Install dependencies
bun install- Set up environment variables
Create a
.envfile in the root directory:
DATABASE_URL=your_postgresql_connection_string- Push database schema
bunx drizzle-kit pushFrontend (Port 3000):
bun run devBackend (Port 3001):
bun run serverBuild the application:
bun run buildStart the production server:
bun run startprogressive-web-app/
├── app/ # Next.js app directory
│ ├── components/ # React components
│ │ ├── Todo.tsx # Main todo component
│ │ └── navigator.jsx # Navigation component
│ ├── layout.tsx # Root layout
│ └── page.tsx # Home page
├── components/ # UI components
│ └── ui/ # Shadcn UI components
├── server/ # Backend server
│ ├── db/ # Database configuration
│ │ ├── schema.ts # Database schema
│ │ └── server.ts # Database connection
│ ├── index.ts # Express server
│ └── user.ts # User operations
├── public/ # Static files
├── lib/ # Utility functions
├── drizzle.config.ts # Drizzle ORM configuration
├── .env # Environment variables
└── package.json # Dependencies
- Auto-generated UUID for each user
- Username-based identification
- Persistent session storage
- Create new tasks
- View all tasks
- Update task status (pending/completed)
- Task persistence in PostgreSQL
- Timestamp tracking for each task
- PWA capabilities for offline access
- Service worker integration
- App installation support
- User creates account with username
- UUID generated and stored locally
- User added to PostgreSQL database
- Tasks created and synced to database
- Real-time UI updates with optimistic rendering
- Status changes persisted to backend
- Client-side validation
- Server-side error responses
- User-friendly error messages
- Console logging for debugging
- Database transaction safety
Use Postman or any API client to test endpoints:
POST http://localhost:3001/api/users
Body: { "uuid": "...", "username": "John Doe" }
POST http://localhost:3001/api/users/:uuid/tasks
Body: { "task": { "id": "1", "title": "Buy groceries", "status": "pending", "completed": false } }
PATCH http://localhost:3001/api/users/:uuid/tasks/:taskId/status
Body: { "status": "completed" }
Built with modern web technologies focusing on:
- Type safety with TypeScript
- Performance optimization
- User experience
- Scalability
- Code maintainability