A simple todo application built with Next.js, tRPC, and Drizzle.
- Features
- Prerequisites
- Installation
- Project Structure
- Usage
- Environment Variables
- Deployment
- Contributing
- License
- Create, read, update, and delete todo items
- Full-stack type safety using tRPC
- Database interactions handled by Drizzle
- Server-side rendering and API routes using Next.js
- Node.js (v20 or higher recommended)
- npm or pnpm
- A PostgreSQL database (Neon, Prisma, Supabase, Docker, etc.)
-
Clone the repository:
git clone https://github.com/v3ceban/todo.git
-
Navigate to the project directory:
cd todo
-
Install dependencies:
# Using npm npm install # or using pnpm pnpm install
Below is a simplified overview of the src
directory structure:
./src/
├── app/ # Next.js app directory (pages, API routes, etc.)
├── components/ # Reusable React components
├── hooks/ # Custom React hooks
├── lib/ # Utility functions
├── server/ # Server-side code (tRPC, database, authentication, server actions)
├── styles/ # Global styling
├── trpc/ # tRPC API definitions
└── ...
-
Start the development server:
# Using npm npm run dev # Using pnpm pnpm run dev
-
Open the app in the browser at http://localhost:3000.
-
Create Todo Items: Use the UI to authenticate and view/add/edit/remove your todo tasks.
Create a file named .env
or .env.local
in the root directory and add required environment variables. For example:
AUTH_SECRET="secret"
AUTH_GOOGLE_ID="google_id"
AUTH_GOOGLE_SECRET="google_secret"
DATABASE_URL=postgresql://user:password@localhost:5432/database_name
You can find required environment variables in .env.example
.
-
Build the application for production:
# Using npm npm run build # Using pnpm pnpm run build
-
Start the production server:
# Using npm npm run start # Using pnpm pnpm run start
-
Deploy on your preferred platform (e.g., Vercel, AWS, or Docker). Make sure to set your environment variables accordingly on the hosting service.
This project is licensed under the MIT License. See the LICENSE file for details.