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

FeaturesInstallationUsageProject StructureContributing

✨ 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

Packages

Contributors

Languages