create-rust-on-vercel
v1.0.5
Published
Scaffold a new Rust project for Vercel with a Next.js frontend.
Maintainers
Readme
🦀 Create Rust on Vercel
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-projectGlobal Installation
npm install -g create-rust-on-vercel
create-rust-on-vercel my-awesome-projectLocal 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-vercelThe CLI will prompt you for a project name if not provided.
Direct Mode
npx create-rust-on-vercel my-project-nameWhat happens when you run it:
- 📥 Downloads template from GitHub repository
- 📝 Updates configuration files with your project name
- 🔄 Updates Rust imports to match your project structure
- 📦 Installs Node.js dependencies via npm
- 🦀 Builds Rust project via cargo
- 🎉 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:
- 🍴 Fork the repository
- 🌟 Create a feature branch:
git checkout -b feature/amazing-feature - 💫 Commit your changes:
git commit -m 'Add amazing feature' - 📤 Push to the branch:
git push origin feature/amazing-feature - 🎉 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
- 📧 Email: [email protected]
- 🐙 GitHub: @peterkyle01
🙏 Acknowledgments
- 🦀 Rust - Systems programming language
- ⚡ Vercel - Deployment platform
- ⚛️ Next.js - React framework
- 🎨 Tailwind CSS - Utility-first CSS framework
📊 Stats
Made with ❤️ and 🦀 by Peter Mwangi
