Getting Started
Get up and running with the Arcway framework
Get up and running with Arcway.
Quick Start
mkdir my-app && cd my-app
npm init -y
npm install arcway better-sqlite3
npx arcway bootstrap
npx arcway devThe bootstrap command scaffolds a complete starter project with sample API routes, a migration, an event listener, a scheduled job, and a page. You're ready to build.
Manual Setup
If you prefer to set things up yourself:
# Create project
mkdir my-app && cd my-app
npm init -y
npm install arcway better-sqlite3
# Create config
cat > arcway.config.js << 'EOF'
export default {
database: {
client: 'better-sqlite3',
connection: { filename: './data.db' },
},
};
EOF
# Create a migration
mkdir -p migrations
cat > migrations/20260101000000-create-users.js << 'EOF'
export async function up(knex) {
await knex.schema.createTable('users', (table) => {
table.increments('id').primary();
table.string('name').notNullable();
table.string('email').notNullable().unique();
table.timestamps(true, true);
});
}
export async function down(knex) {
await knex.schema.dropTableIfExists('users');
}
EOF
# Create a route
mkdir -p api/users
cat > api/users/index.js << 'EOF'
export const GET = {
handler: async (ctx) => {
const { db } = ctx;
const users = await db('users').select('*');
return { data: users };
},
};
export const POST = {
schema: {
body: { name: 'string >= 1', email: 'string.email' },
},
handler: async (ctx) => {
const { db, events } = ctx;
const [id] = await db('users').insert(ctx.req.body);
await events.emit('users/created', { id, ...ctx.req.body });
return { status: 201, data: { id } };
},
};
EOF
# Start dev server
npx arcway devProject Structure
my-app/
├── arcway.config.js # Framework configuration
├── .env # Environment variables
├── .env.local # Local overrides (gitignored)
├── api/ # File-based routing
│ ├── _middleware.js # Global middleware for all API routes
│ ├── users/
│ │ ├── _middleware.js # Middleware for /users/*
│ │ ├── index.js # GET/POST /users
│ │ ├── [id].js # GET/PUT/DELETE /users/:id
│ │ └── [id]/
│ │ └── projects.js # GET /users/:id/projects
│ └── billing/
│ └── invoices/
│ ├── index.js # GET/POST /billing/invoices
│ └── [invoiceId].js # GET /billing/invoices/:invoiceId
├── listeners/ # Event listeners (path = event name)
│ ├── users/
│ │ └── created.js # Handles 'users/created' event
│ └── system/
│ ├── init.js # Runs during boot
│ └── ready.js # Runs after server starts
├── jobs/ # Background jobs
│ ├── send-welcome-email.js # On-demand job
│ └── generate-invoice.js # Cron-scheduled job
├── migrations/ # Knex migrations (timestamp-ordered)
│ ├── 20260101000000-create-users.js
│ └── 20260101000001-create-projects.js
├── seeds/ # Seed files
│ └── 001_seed_users.js
├── pages/ # SSR pages (optional)
│ ├── index.jsx # /
│ └── blog/
│ └── [slug].jsx # /blog/:slug
├── plugins/ # Plugins (optional): routes, jobs, tools
│ └── web-search/
│ └── plugin.js # Plugin manifest
└── .build/ # Build artifacts (gitignored)Key conventions:
- API routes live in
api/-- file path maps to URL pattern - Listeners go in
listeners/-- folder path determines which event they handle - Jobs go in
jobs/-- background tasks with cron schedules or continuous loops - Migrations go in
migrations/-- timestamp-ordered, run automatically on boot - Plugins go in
plugins/-- self-contained packages of routes, jobs, and tools (see Plugins & Capabilities) - Files starting with
_are middleware or layouts, not routes
CLI Commands
| Command | Description |
|---|---|
arcway bootstrap | Scaffold a new project in the current directory |
arcway dev | Start development server with hot-reload |
arcway start | Start production server |
arcway build [outDir] | Build pages for production |
arcway test [args...] | Run tests via Vitest |
arcway seed | Run database seed files |
arcway docs [outFile] | Generate OpenAPI specification |
arcway schema [outFile] | Generate database schema documentation |
arcway graphql:schema [outFile] | Export merged GraphQL SDL |
arcway lint | Check for boundary violations |
arcway migrate make <name> | Create a new migration file |
arcway migrate run | Run pending migrations |
arcway migrate rollback | Rollback last migration batch |
arcway mcp | Start MCP stdio server for AI agents |