A modern todo application built with Next.js 14, featuring server actions, authentication, and PostgreSQL database.
- 🔐 Authentication with NextAuth.js
- 📝 CRUD operations for tasks
- 🎯 Real-time task updates
- 🎨 Modern UI with Tailwind CSS
- 🔄 Optimistic updates
- 🐳 Docker support
- ⚡ Biome.js for fast linting and formatting
- ✅ Jest testing setup with example tests
The project uses Biome for linting and formatting, providing:
- Fast performance (written in Rust)
- Zero configuration needed
- Unified tooling (replaces ESLint + Prettier)
- TypeScript support out of the box
Run the following commands:
npm run lint # Check for code issues
npm run format # Format code
npm run check # Check and auto-fix issues
Before you begin, ensure you have the following installed:
- Node.js 18+ (for local development)
- npm (comes with Node.js)
- Docker and Docker Compose
# Copy environment file
cp .env.example .env
# Start the development server
docker compose up dev -d
# The app will be available at http://localhost:3000
# Any code changes will automatically reload
# To stop the app and all services
docker compose down
# Start the production server
docker compose up app -d
# The app will be available at http://localhost:3001
The database schema is automatically synchronized on startup, but if you make changes to the schema:
# Apply schema changes
docker compose exec dev npx prisma db push
# Generate Prisma client after schema changes
docker compose exec dev npx prisma generate
# If you need to reset the database
docker compose exec dev npx prisma db reset
- Start the development server:
docker compose up dev -d
-
Make changes to your code - they will automatically reload
-
If you modify the database schema (
prisma/schema.prisma
):
# Apply schema changes
docker compose exec dev npx prisma db push
# Generate Prisma client
docker compose exec dev npx prisma generate
- View logs:
# Development logs
docker compose logs -f dev
# Database logs
docker compose logs -f db
- Stop all services:
docker compose down
If you see Prisma client initialization errors:
# Regenerate Prisma client
docker compose exec dev npx prisma generate
# Verify database connection and sync schema
docker compose exec dev npx prisma db push
# Check if database is running
docker compose ps
# View database logs
docker compose logs db
# Reset database (WARNING: This will delete all data)
docker compose exec dev npx prisma db reset
You can create a test user with predefined credentials using:
# Using Docker
docker compose exec dev npx ts-node scripts/create-user.ts
# Without Docker
npx ts-node scripts/create-user.ts
This will create a user with:
- Email: [email protected]
- Password: password123
- Install dependencies:
npm install
- Set up environment variables:
cp .env.example .env
- Update
.env
to use localhost database:
DATABASE_URL="postgresql://postgres:postgres@localhost:5432/todo_app"
- Start the PostgreSQL database:
docker compose up -d db
- Set up the database:
npm run prisma:generate
npm run prisma:push
- Start the development server:
npm run dev
npm run dev
- Start development servernpm run build
- Build for productionnpm start
- Start production servernpm test
- Run testsnpm run test:watch
- Run tests in watch modenpm run lint
- Run Biome linternpm run format
- Format code with Biomenpm run check
- Run Biome checks and auto-fix issuesnpm run prisma:generate
- Generate Prisma clientnpm run prisma:push
- Push database schema changes
├── app/ # Next.js app directory
│ ├── actions/ # Server actions
│ ├── api/ # API routes
│ └── ...
├── components/ # React components
│ ├── auth/ # Authentication components
│ ├── tasks/ # Task-related components
│ └── ...
├── lib/ # Utility functions
├── prisma/ # Database schema
└── types/ # TypeScript types
The project is set up with Jest and React Testing Library. Several example tests are included for components and functionality.
Run tests with:
npm test
Watch mode:
npm run test:watch
Test files are located alongside their components with the .test.tsx
extension.
MIT License - see LICENSE file for details.