Sign inSign up

jimmy0328/dailytodo-backend

By jimmy0328

•Updated 9 months ago

Daily Todolist - FastAPI Backend

Image
0

1.4K

jimmy0328/dailytodo-backend repository overview

⁠Daily Todolist

CI Docker Publish

A full-stack task management application built with React and FastAPI.

⁠Features

  • Task Management: Create, update, delete, and complete tasks
  • Categories: Organize tasks with custom categories and colors
  • Calendar View: View tasks by date in a monthly calendar
  • Statistics: Track daily completion rates and trends
  • Today's Focus: View today's tasks and overdue items
  • Search & Filter: Filter tasks by status, category, and due date
  • JWT Authentication: Secure single-user authentication

⁠Tech Stack

⁠Frontend
  • React 19
  • Vite 7
  • React Router 7
  • Axios
⁠Backend
  • FastAPI
  • SQLAlchemy
  • SQLite
  • JWT Authentication (python-jose)
  • Pydantic

⁠Project Structure

dailytodo/
├── docker-compose.yml       # Docker services configuration
├── data/                    # SQLite database (Docker volume)
├── backend/
│   ├── Dockerfile           # Backend container image
│   ├── app/
│   │   ├── models/          # SQLAlchemy ORM models
│   │   ├── routers/         # API route handlers
│   │   ├── schemas/         # Pydantic validation schemas
│   │   ├── utils/           # Authentication utilities
│   │   ├── config.py        # App configuration
│   │   ├── database.py      # Database connection
│   │   └── main.py          # FastAPI app entry point
│   ├── requirements.txt
│   └── .env.example         # Environment variables template
├── frontend/
│   ├── Dockerfile           # Frontend container image
│   ├── nginx.conf           # Nginx configuration
│   ├── src/
│   │   ├── components/      # Reusable React components
│   │   ├── pages/           # Page components
│   │   ├── hooks/           # Custom React hooks
│   │   ├── services/        # API client
│   │   └── App.jsx          # App entry point
│   └── package.json
└── docs/
    └── plans/               # Design documents

⁠Getting Started

The easiest way to run the application is using Docker Compose.

⁠Prerequisites
  • Docker
  • Docker Compose
⁠Quick Start
# Build and start all services
docker compose up -d

# View logs
docker compose logs -f

# Stop services
docker compose down
⁠Access
⁠Environment Variables

Create a .env file in the project root to customize settings:

# Admin credentials
ADMIN_USERNAME=admin
ADMIN_PASSWORD=your-secure-password

# JWT secret (change in production!)
SECRET_KEY=your-secret-key-change-in-production

Or pass them directly:

ADMIN_USERNAME=myuser ADMIN_PASSWORD=mypass docker compose up -d

⁠Option 2: Manual Setup
⁠Prerequisites
  • Python 3.10+
  • Node.js 18+
⁠Backend Setup
cd backend

# Create virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Start server
uvicorn app.main:app --reload

The API will be available at http://localhost:8000

⁠Frontend Setup
cd frontend

# Install dependencies
npm install

# Start development server
npm run dev

The app will be available at http://localhost:5173

⁠Default Credentials
  • Username: admin
  • Password: changeme123

⁠API Endpoints

MethodEndpointDescription
POST/api/auth/loginGet JWT token
GET/api/auth/meGet current user
GET/api/tasksList all tasks
GET/api/tasks/todayGet today's tasks
POST/api/tasksCreate task
PUT/api/tasks/{id}Update task
DELETE/api/tasks/{id}Delete task
PATCH/api/tasks/{id}/completeToggle completion
GET/api/categoriesList categories
POST/api/categoriesCreate category
PUT/api/categories/{id}Update category
DELETE/api/categories/{id}Delete category
GET/api/stats/dailyGet daily stats
GET/api/stats/rangeGet stats by date range

⁠Development

⁠Run Tests
cd backend
pytest
⁠Lint Frontend
cd frontend
npm run lint

⁠CI/CD

This project uses GitHub Actions for continuous integration and deployment.

⁠Workflows
WorkflowTriggerDescription
CIPush/PR to mainRun tests and build Docker images
Docker PublishPush to main, tags (v*)Build and push images to Docker Hub
⁠Setup Docker Hub Publishing
  1. Create a Docker Hub account and access token

  2. Add the following secrets to your GitHub repository:

    • DOCKERHUB_USERNAME - Your Docker Hub username
    • DOCKERHUB_TOKEN - Your Docker Hub access token
  3. Push a tag to trigger a release:

    git tag v1.0.0
    git push origin v1.0.0
    
⁠Docker Images

After publishing, images will be available at:

  • <your-username>/dailytodo-backend:latest
  • <your-username>/dailytodo-frontend:latest

⁠License

MIT

Tag summary

Content type

Image

Digest

sha256:2d9242ec6…

Size

76.9 MB

Last updated

9 months ago

docker pull jimmy0328/dailytodo-backend