A simple, efficient todo list application built with Node.js and Express. Perfect for personal task management with a clean, intuitive interface.
- Features
- Prerequisites
- Installation
- Usage
- Docker Deployment
- Configuration
- Available Scripts
- Project Structure
- Logging
- Database
- Development Tools
- Contributing
- License
- β¨ Create, read, update, and delete todos
- π¨ Simple and intuitive interface
- πΎ SQLite database for data persistence
- π Comprehensive logging system with Winston
- βοΈ Environment-specific configurations
- π‘οΈ Error handling and monitoring
- π Request logging with performance tracking
- π― Pug templating engine
- π TypeScript support
- π§Ή ESLint and Prettier for code quality
- Node.js (v14 or higher)
- npm (v6 or higher)
- Git
-
Clone the repository:
git clone https://github.com/yourusername/lazy-todolist-nodejs.git cd lazy-todolist-nodejs -
Install dependencies:
npm install
-
Create a
.envfile in the root directory (optional):NODE_ENV=development PORT=8080
Start the development server with hot reloading:
npm run devThe application will be available at http://localhost:8080
To run the application in production mode:
NODE_ENV=production npm startThe application can be deployed using Docker with PostgreSQL as the production database.
- Docker
- Docker Compose
-
Build and start the containers:
docker-compose up --build
-
The application will be available at
http://localhost:8080
For local development using Docker:
docker-compose -f docker-compose.dev.yml up --buildThe following environment variables can be configured:
| Variable | Description | Default |
|---|---|---|
NODE_ENV |
Application environment | development |
PORT |
Server port | 8080 |
DB_USER |
PostgreSQL username | postgres |
DB_HOST |
PostgreSQL host | postgres |
DB_NAME |
PostgreSQL database name | todolist |
DB_PASSWORD |
PostgreSQL password | postgres |
DB_PORT |
PostgreSQL port | 5432 |
| Command | Description |
|---|---|
npm start |
Start the production server |
npm run dev |
Start the development server with hot reload |
npm run build |
Build the application for production |
npm run clean |
Clean the dist directory |
npm run lint |
Run ESLint to check code style |
npm run format |
Format code using Prettier |
npm test |
Run tests |
src/
βββ config/
β βββ logger.ts # Winston logger configuration
β βββ database.ts # SQLite database configuration
βββ controllers/ # Route controllers
βββ public/ # Static assets (CSS, JS, images)
βββ routes/ # Express routes
βββ views/ # Pug templates
βββ index.ts # Application entry point
The application uses Winston for structured logging with the following features:
- Multiple log levels (error, warn, info, debug)
- Environment-specific log formats:
- Development: Colorized console output with timestamps
- Production: JSON format with full error stack traces
- Separate log files for errors and combined logs
- Log rotation with 5MB file size limit and 5 files retention
- Request logging with duration, status, and user agent info
- Structured error tracking with context
Logs are stored in:
- Error logs:
logs/error.log - Combined logs:
logs/combined.log
SQLite database with automatic table creation:
- Location:
data/database.sqlite - Tables:
- tasks (id, title, createdAt, updatedAt)
- TypeScript for type-safe development
- ts-node-dev for hot reloading
- ESLint with TypeScript support
- Prettier for code formatting
- Jest for testing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
- Follow the existing code style
- Add tests for new features
- Update documentation as needed
- Ensure all tests pass before submitting PR
- Add meaningful commit messages
This project is licensed under the ISC License - see the LICENSE file for details.