This guide will help you set up and run Task Flow API on your local machine.
Before you begin, ensure you have the following installed:
- Node.js (v16.0.0 or higher, v18+ recommended)
- npm (v7.0.0 or higher)
- Git (for cloning the repository)
You can verify your installations:
node --version
npm --version
git --versiongit clone https://github.com/chingalo-family/task-flow-api.git
cd task-flow-apiThe easiest way to get started is using the automated setup script:
chmod +x setup.sh
./setup.shThis script will:
- ✅ Create
.envfile from.env.sample - ✅ Install all npm dependencies
- ✅ Generate Prisma Client
- ✅ Run database migrations
- ✅ Set up the SQLite database
If you prefer manual setup or the script doesn't work:
cp .env.sample .envnpm installnpx prisma generatenpx prisma migrate dev --name initOpen .env file and update the following variables:
# Database Configuration
DB_NAME=taskflow.db
DATABASE_URL="file:./${DB_NAME}"
# Server Configuration
PORT=3000
# JWT Configuration
JWT_SECRET="your-secret-key-here-change-in-production"
JWT_EXPIRATION=7d
# Password Reset Token (1 hour in milliseconds)
RESET_TOKEN_EXPIRATION=3600000
# Frontend URL (for password reset links)
FRONTEND_URL=http://localhost:3000For password reset functionality, configure SMTP settings. See Email Setup Guide for detailed instructions.
# Uncomment and configure for email functionality
# SMTP_HOST=smtp.gmail.com
# SMTP_PORT=587
# SMTP_USER=your-email@gmail.com
# SMTP_PASS=your-app-password
# SMTP_FROM=noreply@taskflow.comNote: Without email configuration, password reset tokens will be logged to the console (useful for development).
Start the development server with hot reload:
npm run devThe server will start at http://localhost:3000
You'll see output like:
🚀 Server running on port 3000
📚 Swagger docs available at http://localhost:3000/api-docs
Build and run in production mode:
# Build the TypeScript code
npm run build
# Start the production server
npm startFor production deployment with PM2, see the Deployment Guide.
Open your browser and navigate to:
http://localhost:3000/api-docs
You should see the Swagger API documentation interface.
Try registering a new user:
curl -X POST http://localhost:3000/api/auth/register \
-H "Content-Type: application/json" \
-d '{
"username": "testuser",
"email": "test@example.com",
"password": "password123",
"name": "Test User"
}'Expected response:
{
"token": "eyJhbGc...",
"user": {
"id": "uuid-here",
"username": "testuser",
"email": "test@example.com",
"name": "Test User"
}
}Open Prisma Studio to view and manage your database:
npx prisma studioThis opens a GUI at http://localhost:5555 where you can:
- View all database tables
- Edit records
- Run queries
- Inspect relationships
Now that you have Task Flow API running:
- Explore the API: Visit
http://localhost:3000/api-docsto see all available endpoints - Read the API Reference: Check API Reference for detailed endpoint documentation
- Understand the Architecture: See Architecture Guide
- Start Development: Read the Development Guide
- Configure for Production: Follow the Deployment Guide
If port 3000 is already in use, change the PORT in .env:
PORT=3001If migrations fail, try:
# Reset the database
npx prisma migrate reset
# Re-run migrations
npx prisma migrate dev --name initIf you see "Cannot find module '@prisma/client'":
npx prisma generateIf you can't run shell scripts:
chmod +x setup.sh
chmod +x deploy.shFor more troubleshooting, see the Troubleshooting Guide.
- Prisma - Syntax highlighting for Prisma schema
- ESLint - JavaScript/TypeScript linting
- REST Client - Test API endpoints directly in VS Code
- Thunder Client - Alternative API testing tool
# View database schema
npx prisma studio
# Format Prisma schema
npx prisma format
# View migration status
npx prisma migrate status
# View server logs (in development)
npm run dev- Express.js: https://expressjs.com/
- Prisma: https://www.prisma.io/docs/
- TypeScript: https://www.typescriptlang.org/docs/
- Zod: https://zod.dev/
- JWT: https://jwt.io/
- Documentation: Browse other guides in the docs folder
- Issues: Report bugs on GitHub Issues
- Discussions: Ask questions in GitHub Discussions