A Rust project template featuring a todo application with SQLite database and terminal user interface (TUI).
- π Todo management with SQLite persistence
- π₯οΈ Interactive Terminal User Interface (TUI)
- π§ Command Line Interface (CLI)
- π§ͺ Comprehensive test suite
- π CI/CD with GitHub Actions
- π¦ Cross-platform releases
- π Security auditing
- π³ Docker and Docker Compose support
- βοΈ Nix flakes for reproducible environments
- π¦ Devcontainer configuration for GitHub Codespaces
π‘ Quick Start: See SETUP.md for detailed setup instructions using Docker, Nix, Codespaces, or local development.
git clone https://github.com/pnstack/template-rust.git
cd template-rust
cargo build --releaseDownload the latest binary from the Releases page.
# Build the image
docker build -t template-rust:latest .
# Run with interactive TUI
docker run --rm -it -v $(pwd)/data:/app/data template-rust:latest tui
# Or use Docker Compose
docker compose up# Enter development environment
nix develop
# Or run directly
nix runClick the "Code" button on GitHub and select "Create codespace on main" - everything is pre-configured!
# Show help
./template-rust --help
# Add a new todo
./template-rust add "Buy groceries" --description "Milk, eggs, bread"
# List all todos
./template-rust list
# List only completed todos
./template-rust list --completed
# List only pending todos
./template-rust list --pending
# Complete a todo (use the ID from list command)
./template-rust complete <todo-id>
# Delete a todo
./template-rust delete <todo-id>
# Start interactive TUI (default mode)
./template-rust tuiStart the interactive mode:
./template-rust tuih- Show helpn- Add new todod- Delete selected todoc- Toggle todo completion statusa- Show all todosp- Show pending todos onlyf- Show completed todos onlyββ- Navigate todosq- Quit application
template-rust/
βββ .github/workflows/ # CI/CD workflows
βββ src/
β βββ database/ # Database layer
β βββ models/ # Data models
β βββ tui/ # Terminal UI
β βββ lib.rs # Library root
β βββ main.rs # CLI application
βββ tests/ # Integration tests
βββ docs/ # Documentation
βββ examples/ # Usage examples
π Full Setup Guide: See SETUP.md for comprehensive development environment setup instructions.
Choose your preferred development method:
- Local: Rust 1.70 or later, SQLite3
- Docker: Docker 20.10+ and Docker Compose
- Nix: Nix package manager with flakes enabled
- Codespaces: Just a GitHub account!
# Local
cargo build
# Docker
docker compose up --build
# Nix
nix buildcargo testcargo clippy -- -D warningscargo fmtThe project provides multiple development environment options:
- Docker Compose:
docker compose up dev- Containerized development with live code mounting - Nix Flakes:
nix develop- Reproducible environment with all dependencies - Devcontainer: Open in VS Code or GitHub Codespaces - Fully configured IDE
- Traditional: Local Rust installation with cargo
The application uses SQLite for persistence. By default, it creates a todo.db file in the current directory. You can specify a different database path:
./template-rust --database /path/to/your/todos.db listFor testing with in-memory database:
./template-rust --database ":memory:" add "Test todo"The project includes comprehensive GitHub Actions workflows:
- CI (
ci.yml): Build, test, lint, and format checks on multiple platforms (Linux, macOS, Windows) - Security (
security.yml): Weekly security audits withcargo audit - Release (
release.yml): Automated binary releases for Linux, macOS, and Windows on version tags - Docker (
docker.yml): Docker image build testing and docker-compose validation
All workflows run automatically on push and pull requests to ensure code quality and security.
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Ensure all tests pass
- Submit a pull request
This project is licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.