generated from ludops/ludops-skeleton
3.5 KiB
3.5 KiB
Todo App - Setup Guide
Overview
This is a task management application that helps you track tasks with repeating schedules and priorities.
Features
- Timeline View: Visual timeline showing past (15 days) and future (30 days) tasks
- Today's Tasks: Organized by priority (Essential / When I have time)
- Task Management: Create, complete, and renew tasks
- Recurring Tasks: Support for daily, weekly, monthly, and yearly repetition
- Priority Levels: Essential (always visible) and When I have time (collapsible)
Tech Stack
- Backend: Node.js + Fastify + Drizzle ORM
- Frontend: React + TypeScript + Vite
- Database: PostgreSQL
- Build: Turborepo monorepo
Local Development Setup
Prerequisites
- Node.js (v18 or higher)
- pnpm (
npm install -g pnpm) - Docker Desktop (for local database)
Steps
-
Clone the repository
git clone <your-repo-url> cd ludops-todo -
Install dependencies
pnpm install -
Set up environment
cp .env.example .envThe .env file should contain:
DATABASE_URL=postgres://postgres:postgres@localhost:5432/todo_db -
Start local database
docker compose -f docker-compose.dev.yml up -d -
Push database schema
cd apps/api pnpm db:push push -
Start development servers
In one terminal (backend):
cd apps/api pnpm devIn another terminal (frontend):
cd apps/web pnpm dev -
Open the app
Frontend: http://localhost:5173 Backend API: http://localhost:3000
Database Schema
Tasks Table
| Column | Type | Description |
|---|---|---|
id |
serial | Primary key |
name |
varchar(60) | Task name (required) |
created_on |
timestamp | Creation timestamp |
updated_on |
timestamp | Last update timestamp |
last_completed_on |
timestamp | Last completion date (nullable) |
does_repeat |
boolean | Whether task repeats |
repeats_every |
varchar(20) | Format: X_UNIT (e.g., 1_WEEKS, 2_MONTHS) |
priority |
enum | ESSENTIAL or WHEN_I_HAVE_TIME |
API Endpoints
GET /api/tasks- Get all tasksPOST /api/tasks- Create a new taskPATCH /api/tasks/:id/complete- Mark task as completedPATCH /api/tasks/:id/renew- Renew task (reset completion date)
Task Logic
Due Date Calculation
- Non-repeating tasks: Due immediately if
last_completed_onis null - Repeating tasks: Due date =
last_completed_on + repeats_every - Today's tasks: Any task with due date <= today
Timeline Display
- Tasks are positioned on a 45-day timeline (15 past + 30 future)
- TODAY marker is at 33.33% from the left
- Tasks on the same day are stacked horizontally by priority
- Only shows tasks within the timeline range
Production Deployment
See the main README.md for CI/CD deployment instructions using Gitea and Docker.
Troubleshooting
Database connection issues
- Make sure Docker is running:
docker ps - Check database is accessible:
docker exec -it ludops-todo-db-dev psql -U postgres -d todo_db
Port conflicts
- Frontend (5173): Change in
apps/web/vite.config.ts - Backend (3000): Change in
apps/api/src/index.ts - Database (5432): Change in
docker-compose.dev.yml
Schema changes
After modifying schema files in apps/api/src/db/schemas/, run:
cd apps/api
pnpm db:push push