| Crates.io | begin-rs-web |
| lib.rs | begin-rs-web |
| version | 0.1.2 |
| created_at | 2025-12-06 10:39:55.163854+00 |
| updated_at | 2025-12-06 11:13:54.201373+00 |
| description | A CLI tool for bootstrapping production-ready Rust web applications with Axum, authentication, and database support |
| homepage | https://github.com/ezesundayeze/begin-rs-web |
| repository | https://github.com/ezesundayeze/begin-rs-web |
| max_upload_size | |
| id | 1969966 |
| size | 139,501 |
A CLI tool for bootstrapping production-ready Rust web applications with Axum, authentication, user management, and database support.
cargo install begin-rs-web
begin-rs-web
The CLI will guide you through selecting:
begin-rs-web my-app \
--database postgres \
--auth both \
--google-oauth true \
--non-interactive
Usage: begin-rs-web [OPTIONS] [NAME]
Arguments:
[NAME] Name of the project
Options:
-d, --database <DATABASE> Database to use (postgres, mysql, sqlite, mongodb)
-a, --auth <AUTH> Authentication method (jwt, session, both)
-n, --non-interactive Skip interactive prompts
--google-oauth <GOOGLE_OAUTH> Include Google OAuth support [true/false]
--path <PATH> Project path (defaults to ./<name>)
-h, --help Print help
my-app/
├── src/
│ ├── main.rs # Application entry point
│ ├── config.rs # Configuration management
│ ├── error.rs # Error handling
│ ├── app_state.rs # Shared application state
│ ├── db/ # Database connection & pool
│ ├── models/ # Data models (User, Session, etc.)
│ ├── auth/ # Authentication logic (JWT, Sessions, OAuth)
│ ├── routes/ # API route handlers
│ └── middleware/ # Custom middleware (auth, etc.)
├── migrations/ # Database migrations
├── Cargo.toml # Dependencies
├── Dockerfile # Docker container setup
├── docker-compose.yml # Docker Compose configuration
├── .env.example # Environment variables template
├── .gitignore # Git ignore rules
└── README.md # Project documentation
GET /health - Server health statusPOST /auth/signup - Create new user accountPOST /auth/login - Login with email/passwordGET /auth/google - Initiate Google OAuth flow (if enabled)GET /auth/google/callback - OAuth callback handler (if enabled)GET /users/me - Get current user (requires auth)GET /users - List all users (requires auth)GET /users/:id - Get user by ID (requires auth)DELETE /users/:id - Delete user (requires auth + admin role)# Navigate to generated project
cd my-app
# Setup environment
cp .env.example .env
# Edit .env with your configuration
# For SQL databases:
sqlx database create
sqlx migrate run
# Build and run
cargo build
cargo run
The server will start on http://localhost:3000
# Start all services (app + database)
docker-compose up
# Or build and run separately
docker build -t my-app .
docker run -p 3000:3000 --env-file .env my-app
The generated .env.example includes:
# Server
SERVER_HOST=127.0.0.1
SERVER_PORT=3000
# Database
DATABASE_URL=postgresql://user:password@localhost/dbname
# JWT (if enabled)
JWT_SECRET=your-secret-key
JWT_EXPIRATION_HOURS=24
# Sessions (if enabled)
REDIS_URL=redis://127.0.0.1:6379
SESSION_EXPIRATION_HOURS=168
# Google OAuth (if enabled)
GOOGLE_CLIENT_ID=your-client-id
GOOGLE_CLIENT_SECRET=your-client-secret
GOOGLE_REDIRECT_URI=http://localhost:3000/auth/google/callback
# Logging
RUST_LOG=debug,tower_http=debug
curl -X POST http://localhost:3000/auth/signup \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "secure_password",
"name": "John Doe"
}'
curl -X POST http://localhost:3000/auth/login \
-H "Content-Type: application/json" \
-d '{
"email": "user@example.com",
"password": "secure_password"
}'
Full-featured setup with SQL database, stateless auth, and social login.
Lightweight setup perfect for prototypes and small applications.
NoSQL database with maximum authentication flexibility.
# Run the CLI in development
cargo run -- my-app -d postgres -a jwt
# Build release binary
cargo build --release
# Test generated project
cd my-app && cargo check
The template generator is designed to be extensible. To add new features:
src/templates/src/generator.rssrc/config.rssrc/prompts.rsMIT