Skip to content

SHA888/RPRT

πŸš€ RPRT (Rust PostgreSQL React TypeScript) Template

A production-ready, full-stack template for building modern web applications. This monorepo combines the performance and safety of Rust with the flexibility of React and TypeScript, providing a solid foundation for scalable web applications.

πŸ—οΈ Project Structure

RPRT/
β”œβ”€β”€ backend/               # Rust backend service
β”‚   β”œβ”€β”€ src/               # Source code
β”‚   β”œβ”€β”€ api/               # API routes and handlers
β”‚   β”œβ”€β”€ migrations/        # Database migrations
β”‚   β”œβ”€β”€ Dockerfile         # Production Dockerfile
β”‚   β”œβ”€β”€ Dockerfile.dev     # Development Dockerfile
β”‚   └── Cargo.toml         # Rust dependencies
β”‚
β”œβ”€β”€ frontend/             # React frontend
β”‚   β”œβ”€β”€ src/               # Source code
β”‚   β”œβ”€β”€ public/            # Static assets
β”‚   β”œβ”€β”€ nginx.conf         # Nginx configuration
β”‚   β”œβ”€β”€ Dockerfile         # Production Dockerfile
β”‚   β”œβ”€β”€ Dockerfile.dev     # Development Dockerfile
β”‚   └── package.json       # Node.js dependencies
β”‚
β”œβ”€β”€ scripts/              # Development and deployment scripts
β”‚   └── PRD.txt            # Product Requirements Document
β”‚
β”œβ”€β”€ tasks/                # Task management files
β”‚   └── ...
β”‚
β”œβ”€β”€ .dockerignore         # Docker ignore rules
β”œβ”€β”€ .gitignore            # Git ignore rules
β”œβ”€β”€ docker-compose.yml    # Development Docker Compose
β”œβ”€β”€ docker-compose.prod.yml # Production Docker Compose
β”œβ”€β”€ Makefile              # Common tasks automation
β”œβ”€β”€ DEVELOPMENT.md        # Development setup and workflow
β”œβ”€β”€ DEPLOYMENT.md         # Deployment instructions
└── README.md             # This file

🎯 Features

  • Backend: High-performance Rust server with Axum
  • Frontend: Modern React with TypeScript and Vite
  • Database: PostgreSQL with SQLx for type-safe queries
  • Development: Pre-configured with essential tools and workflows

πŸš€ Getting Started

Prerequisites

  • Docker and Docker Compose (recommended)
  • Rust (latest stable) - Only needed for local development without Docker
  • Node.js (v20+) - Only needed for local frontend development
  • PostgreSQL (v17+ recommended) - Only needed for local development without Docker
  • Git

Quick Start with Docker (Recommended)

  1. Clone the repository:

    git clone https://github.com/SHA888/RPRT.git
    cd RPRT
  2. Start the development environment:

    make dev-up

    This will start:

  3. Run database migrations:

    make db-migrate

Local Development (Without Docker)

  1. Set up the backend:

    cd backend
    cp .env.example .env
    # Edit .env with your database credentials
    cargo build
    cargo run
  2. Set up the frontend in a new terminal:

    cd frontend
    cp .env.example .env
    npm install
    npm run dev

Production Deployment

See DEPLOYMENT.md for detailed instructions on deploying to production.

πŸ“š Documentation

πŸ›  Development Workflow

This project uses Task Master for task management. To get started:

  1. View available tasks:

    task-master list
  2. Start working on a task:

    task-master set-status --id=<task_id> --status=in-progress
  3. Mark a task as complete:

    task-master set-status --id=<task_id> --status=done
  4. View the next task to work on:

    task-master next

πŸ› οΈ Tech Stack

  • Backend: Rust (Axum for REST APIs, SQLx for database access)
  • Frontend: React with TypeScript (Vite for fast builds, Tailwind CSS for styling)
  • Database: PostgreSQL with SQLx for type-safe queries
  • Caching: Redis for session management and caching
  • Containerization: Docker and Docker Compose for development and production
  • CI/CD: GitHub Actions for automated testing and deployment
  • Task Management: Task Master for project management

🀝 Contributing

Contributions are welcome! Please read our Contributing Guide for details.

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ› οΈ Tech Stack

  • Backend: Rust (Axum for REST APIs, SQLx for database access)
  • Database: PostgreSQL (relational database)
  • Frontend: React with TypeScript (Vite for fast builds, Tailwind CSS for styling)
  • Tools: GitHub Actions for CI/CD, optional Docker support

πŸ“‹ Prerequisites

Before you begin, ensure you have the following installed:

  • Rust: Stable version (install via rustup)
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  • Node.js: v20 or higher (install via nvm or official installer)
  • PostgreSQL: v17 recommended (install via package manager, e.g., brew install postgresql on macOS)
  • Git: For version control

πŸš€ Setup

1. Clone the Repository

git clone https://github.com/SHA888/RPRT.git
cd RPRT

2. Backend Setup

# Navigate to backend directory
cd backend

# Copy environment file
cp .env.example .env

# Edit .env with your database credentials
# DATABASE_URL=postgres://user:password@localhost:5432/rprt_db

# Install SQLx CLI and run migrations
cargo install sqlx-cli
sqlx migrate run

# Start the backend
cargo run

The backend will be available at: http://localhost:3000

3. Frontend Setup

# Navigate to frontend directory
cd frontend

# Copy environment file
cp .env.example .env

# Edit .env with your API URL
# VITE_API_URL=http://localhost:3000

# Install dependencies
npm install

# Start the development server
npm run dev

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

4. Database Setup

  1. Ensure PostgreSQL is running locally
  2. Create the database:
    createdb rprt_db
  3. Migrations are applied automatically during backend setup

🐳 Optional Docker Setup

For containerized development:

  1. Ensure Docker and Docker Compose are installed
  2. Run the full stack:
    docker-compose -f docker/docker-compose.yml up --build

Access the services:

πŸ§ͺ Testing

Backend Tests

cd backend
cargo test

Frontend Tests

cd frontend
npm test

πŸš€ Deployment

Don't forget to update environment variables in .env files for production URLs.

🀝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch: git checkout -b feature-name
  3. Make your changes
  4. Commit your changes: git commit -m "Add feature"
  5. Push to the branch: git push origin feature-name
  6. Open a pull request

Found a bug or have a suggestion? Please open an issue.

πŸ“„ License

This project is licensed under the MIT License. See the LICENSE file for details.

About

Rust, PostgreSQL, React, TypeScript Template

Resources

License

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors