Skip to content

peterkyle01/create-rust-on-vercel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

11 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ¦€ Create Rust on Vercel

Rust Vercel Next.js TypeScript

A beautiful CLI tool to scaffold Rust projects for Vercel with Next.js frontend

Features β€’ Installation β€’ Usage β€’ Project Structure β€’ Contributing

✨ Features

  • πŸš€ One-command setup - Create a full-stack Rust + Next.js project instantly
  • πŸ“¦ Automatic dependency management - Handles both npm and cargo dependencies
  • 🎨 Beautiful CLI experience - Rich colors, emojis, and progress indicators
  • πŸ”§ Smart configuration - Automatically updates project names and imports
  • πŸ¦€ Rust API endpoints - Pre-configured serverless functions for Vercel
  • ⚑ Next.js frontend - Modern React setup with TypeScript
  • πŸ“ Database ready - Includes SQLx setup and migrations
  • πŸ” Authentication - JWT-based auth system included
  • 🎯 Type-safe - Full TypeScript integration with Rust types

πŸš€ Installation

NPX (Recommended)

npx create-rust-on-vercel my-awesome-project

Global Installation

npm install -g create-rust-on-vercel
create-rust-on-vercel my-awesome-project

Local Development

git clone https://github.com/peterkyle01/create-rust-on-vercel.git
cd create-rust-on-vercel
npm install
npm link

🎯 Usage

🌐 Live Example

See what this CLI creates by visiting our live demo: https://rust-on-vercel-template.vercel.app/

This showcase demonstrates the full-stack Rust + Next.js application that gets generated, complete with authentication, database integration, and API endpoints.

Interactive Mode

npx create-rust-on-vercel

The CLI will prompt you for a project name if not provided.

Direct Mode

npx create-rust-on-vercel my-project-name

What happens when you run it:

  1. πŸ“₯ Downloads template from GitHub repository
  2. πŸ“ Updates configuration files with your project name
  3. πŸ”„ Updates Rust imports to match your project structure
  4. πŸ“¦ Installs Node.js dependencies via npm
  5. πŸ¦€ Builds Rust project via cargo
  6. πŸŽ‰ Ready to go!

πŸ“ Project Structure

my-awesome-project/
β”œβ”€β”€ πŸ¦€ api/                    # Rust serverless functions
β”‚   β”œβ”€β”€ auth/                  # Authentication endpoints
β”‚   β”‚   β”œβ”€β”€ signin.rs         # User login
β”‚   β”‚   β”œβ”€β”€ signup.rs         # User registration
β”‚   β”‚   └── me.rs             # Get current user
β”‚   └── routes/               # API routes
β”‚       └── products.rs       # Example CRUD operations
β”œβ”€β”€ βš›οΈ  app/                   # Next.js App Router
β”‚   β”œβ”€β”€ (auth)/              # Auth pages
β”‚   β”œβ”€β”€ dashboard/           # Protected dashboard
β”‚   └── layout.tsx           # Root layout
β”œβ”€β”€ 🎨 components/            # Reusable React components
β”œβ”€β”€ πŸ“š lib/                   # Shared utilities
β”‚   β”œβ”€β”€ rust/                # Rust utilities
β”‚   └── utils.ts             # TypeScript utilities
β”œβ”€β”€ πŸ—„οΈ  migrations/           # Database migrations
β”œβ”€β”€ πŸ”§ types/                 # TypeScript type definitions
β”œβ”€β”€ βš™οΈ  Cargo.toml            # Rust dependencies
β”œβ”€β”€ πŸ“¦ package.json          # Node.js dependencies
└── πŸš€ vercel.json           # Vercel configuration

πŸ› οΈ Development Workflow

After creating your project:

cd my-awesome-project

# Start development server
vercel dev

# Build for production
npm run build

# Database operations
npm run db:setup          # Setup database and generate types
npm run db:migrate        # Run migrations
npm run generate:types    # Generate TypeScript types from Rust

# Rust operations
npm run rust:build        # Build Rust functions
npm run rust:check        # Check Rust code
npm run rust:check-offline # Check code without database connection

πŸ”§ Configuration

Environment Variables

Copy .env.example to .env.local and configure:

DATABASE_URL="postgresql://user:password@localhost/dbname"
JWT_SECRET="your-super-secret-jwt-key"
NEXTAUTH_SECRET="your-nextauth-secret"

Vercel Deployment

The project includes a vercel.json configuration for seamless deployment:

vercel deploy

🀝 Contributing

Contributions are welcome! Here's how you can help:

  1. 🍴 Fork the repository
  2. 🌟 Create a feature branch: git checkout -b feature/amazing-feature
  3. πŸ’« Commit your changes: git commit -m 'Add amazing feature'
  4. πŸ“€ Push to the branch: git push origin feature/amazing-feature
  5. πŸŽ‰ Open a Pull Request

Development Setup

git clone https://github.com/peterkyle01/create-rust-on-vercel.git
cd create-rust-on-vercel
npm install

# Make your changes to index.js
# Test locally
npx ./index.js test-project

πŸ“ License

This project is licensed under the MIT License.

πŸ‘¨β€πŸ’» Author

Peter Mwangi

πŸ™ Acknowledgments

  • πŸ¦€ Rust - Systems programming language
  • ⚑ Vercel - Deployment platform
  • βš›οΈ Next.js - React framework
  • 🎨 Tailwind CSS - Utility-first CSS framework

πŸ“Š Stats

GitHub stars GitHub forks GitHub issues License: MIT


Made with ❀️ and πŸ¦€ by Peter Mwangi

⭐ Star this repo β€’ πŸ› Report Bug β€’ πŸ’‘ Request Feature

About

A beautiful CLI tool to scaffold Rust projects for Vercel with Next.js frontend

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors