A production-ready Wasp starter template powered by the Swarm code generation framework.
This starter template demonstrates how to build modern Wasp applications using Swarm's code generation functionality. It's designed as a foundation for creating starter templates rather than a complete application, providing minimal but well-structured code that showcases Swarm's features.
Built with:
- Swarm generator framework for dynamic code generation
- Swarm Wasp plugin for Wasp-specific generators
- Feature-based architecture with consistent directory structure and file content
- Type-safe Wasp configuration with fluent API
- shadcn/ui components and Tailwind CSS for styling
- MCP integration for AI-assisted development
- Enhanced App Class: Fluent API for Wasp configuration with helper methods
- Feature-Based Structure: Organised directory layout implemented by the Swarm Wasp plugin
- Swarm Generators: All generators available for rapid development
- Development Scripts: Comprehensive npm scripts for Wasp workflows
- MCP Integration: Ready for AI-assisted development
- Modern UI: shadcn/ui components with Tailwind CSS
- Type Safety: Complete TypeScript support throughout
The template implements the feature-based directory structure defined by the Swarm Wasp plugin:
src/
├── features/
│ └── root/ # Example feature
│ ├── root.wasp.ts # Feature configuration
│ └── client/
│ └── pages/
│ └── Home.tsx # Example page component
├── shared/
│ └── client/
│ ├── components/ # Shared React components
│ │ ├── Layout.tsx # Main layout component
│ │ ├── Header.tsx # Header component
│ │ ├── Footer.tsx # Footer component
│ │ └── ui/ # shadcn/ui components
│ ├── hooks/ # Custom React hooks
│ │ ├── useTheme.tsx # Theme management
│ │ └── useMobile.ts # Mobile detection
│ └── lib/
│ └── utils.ts # Utility functions
├── main.wasp.ts # Main Wasp configuration
└── schema.prisma # Database schema
- Node.js 24.14.1+
- npm
- Wasp 0.24.x
-
Create a new project from this template:
npx @ingenyus/swarm create my-app --template genyus/swarm-wasp-starter
-
Navigate to your project:
cd my-app -
Install and configure dependencies:
npm run reset:wasp
-
Start the development server:
npm run dev
Let's build a complete user management feature to demonstrate Swarm's capabilities:
-
Create the feature:
npm run swarm feature user-management --description "User management feature" -
Add a dashboard route:
npm run swarm route dashboard --feature user-management --path /dashboard --auth
-
Create user CRUD operations:
npm run swarm crud users --feature user-management --dataType User
-
Add an API endpoint:
npm run swarm api getUserStats --feature user-management --method GET --route /api/user-stats --auth
-
Create a background job:
npm run swarm job sendWelcomeEmail --feature user-management --cron "0 9 * * *" --entities User -
Add a query operation:
npm run swarm operation getUserProfile --feature user-management --type query --entities User --auth
This creates a complete feature with:
- Dashboard page with authentication
- Full CRUD operations for users
- API endpoint for user statistics
- Background job for welcome emails
- Query for user profiles
All Swarm Wasp generators are available:
feature- Create feature directories and structureapi- Generate API endpoints with optional middlewarecrud- Create complete CRUD operations for entitiesroute- Generate routes and pages with authenticationjob- Create background jobs with cron schedulingoperation- Generate queries and actionsapi-namespace- Create API namespaces with middlewareconfig- Generate Wasp configuration files
For detailed generator documentation, see the Swarm Wasp Plugin README.
The template includes full MCP (Model Context Protocol) integration for AI-assisted development.
-
Start the MCP server:
npm run swarm:mcp
-
Configure your AI tool (see MCP Setup Guide)
-
Use AI prompts like:
"Create a task management feature with a dashboard, task CRUD operations, and a daily reminder job""Generate an API endpoint for getting user tasks with authentication required""Add a new route for the settings page that requires authentication"
The template uses the native Wasp Spec (@wasp.sh/spec). main.wasp.ts lives at the project root and pulls in a generated features barrel, so you never have to wire each feature into it by hand:
import { app } from "@wasp.sh/spec";
import Layout from "./src/shared/client/components/Layout" with { type: "ref" };
import { featureSpecs } from "./src/features/index.wasp";
export default app({
name: "swarm_wasp_starter",
title: "Swarm Wasp Starter",
wasp: { version: "^0.24.0" },
head: [
'<meta name="description" content="Swarm Wasp Starter description" />',
'<meta name="viewport" content="width=device-width, initial-scale=1.0" />',
'<meta charSet="UTF-8" />',
],
client: { rootComponent: Layout },
spec: [featureSpecs],
});Each feature directory holds a feature.wasp.ts that exports a native spec array. Swarm's generators produce these declarations (and their with { type: "ref" } imports) for you:
import { type Spec, api, crud, job, route, page } from "@wasp.sh/spec";
import { Dashboard } from "./client/pages/Dashboard" with { type: "ref" };
import { getStats } from "./server/apis/getStats" with { type: "ref" };
import { sendReport } from "./server/jobs/sendReport" with { type: "ref" };
export const spec: Spec = [
// Route definitions
route("dashboard", "/dashboard", page(Dashboard, { authRequired: true })),
// Api definitions
api("GET", "/api/stats", getStats, { auth: true }),
// Crud definitions
crud("Users", "User", { getAll: {}, create: {} }),
// Job definitions
job(sendReport, {
executor: "PgBoss",
entities: ["User", "Task"],
schedule: { cron: "0 9 * * 1" }, // Every Monday at 9 AM
}),
];The template includes comprehensive npm scripts for Wasp development:
dev,start- Start the Wasp development serverstart:wasp- Start Wasp with TypeScript setupstart:db- Start the database only
reset,rs- Reset Wasp (clean + ts-setup)reset:wasp,rsw- Full Wasp reset without startingreset:db,rsd- Reset and migrate databasereset:all,rta- Reset both Wasp and database
rebuild,rb- Rebuild Wasp projectrebuild:wasp,rbw- Clean and rebuild Wasprebuild:db,rbd- Reset database migrationsrebuild:all,rba- Rebuild everything
restart,rt- Restart Wasp development serverrestart:wasp,rtw- Restart Wasp with resetrestart:db,rtd- Restart database
swarm- Run Swarm CLI commandsswarm:mcp- Start Swarm MCP server
lint- Run ESLintlint:fix- Fix ESLint issues automaticallyformat- Format code with Prettierformat:check- Check Prettier formattingtypecheck- Run TypeScript type checkingvalidate- Run all quality checks
add-ui- Add shadcn/ui components
The template includes a script for adding shadcn/ui components:
npm run add-uiThis will prompt you to select components to add to your project.
Override Swarm generator templates by placing custom versions in:
.swarm/templates/wasp/
├── api/
│ └── api.eta
├── crud/
│ └── crud.eta
└── route/
└── page.eta
Customise Swarm generators via swarm.config.json:
{
"plugins": {
"@ingenyus/swarm-wasp": {
"plugin": "wasp",
"enabled": true,
"generators": {
"api": { "enabled": true },
"crud": { "enabled": true },
"route": { "enabled": true }
}
}
}
}- Explore the generators - Try different Swarm generators to understand their capabilities
- Set up MCP - Configure AI tool integration for enhanced development
- Customise the template - Add your own components and styling
- Create your features - Build your application using the feature-based structure
- Deploy - Use Wasp's deployment features to host your application
- Swarm Documentation
- Swarm Wasp Plugin
- Plugin Development Guide
- MCP Setup Guide
- Wasp Documentation
- shadcn/ui Documentation
MIT