---
title: "Deploy rust-react-starter"
description: "  Rust (Axum) + Next.js monorepo with PostgreSQL and type-safe API SDK"
category: "Starters"
url: https://railway.com/deploy/rust-react-starter
---

# Deploy rust-react-starter

  Rust (Axum) + Next.js monorepo with PostgreSQL and type-safe API SDK

**[Deploy rust-react-starter on Railway](https://railway.com/template/rust-react-starter)**

- **Creator:** Trevor Trinh's Projects
- **Category:** Starters
- **Total deploys:** 6

## Template content

### frontend https://devicons.railway.app/nextjs

- **Source:** https://github.com/trevor-trinh/rust-react-starter
- **Public domain:** Yes

### Postgres https://devicons.railway.app/i/postgresql.svg

- **Image:** ghcr.io/railwayapp-templates/postgres-ssl:17

### backend https://devicons.railway.app/rust

- **Source:** https://github.com/trevor-trinh/rust-react-starter

## Documentation

# Deploy and Host rust-react-starter on Railway

  A production-ready fullstack monorepo combining Rust (Axum) backend
  with Next.js frontend, featuring PostgreSQL database, WebSocket
  real-time updates, and automatic TypeScript SDK generation from
  OpenAPI schemas. Built for type safety across the entire stack with
  compile-time guarantees.

https://github.com/trevor-trinh/rust-react-starter

  ## About Hosting rust-react-starter

  Deploying rust-react-starter involves running three services: a Rust
  backend API server with REST and WebSocket endpoints, a Next.js
  frontend with server-side rendering, and a PostgreSQL database. The
  backend uses SQLx for compile-time verified queries and utoipa for
  automatic OpenAPI spec generation. The frontend automatically
  generates a type-safe SDK from the backend's OpenAPI schema, ensuring
  end-to-end type safety. The architecture supports real-time features
  via WebSockets with broadcast channels, making it ideal for
  collaborative applications. Docker images are optimized for production
   with multi-stage builds and standalone Next.js output.

  ## Common Use Cases

  - **Real-time collaborative applications** - Todo apps, dashboards, or
   project management tools with live updates across clients
  - **Type-safe API development** - Projects requiring guaranteed type
  consistency between Rust backend and TypeScript frontend
  - **Full-stack prototypes** - Rapid development of modern web
  applications with production-ready architecture and database
  migrations

  ## Dependencies for rust-react-starter Hosting

  - **PostgreSQL** - Primary database for application data with SQLx
  migrations
  - **Rust toolchain** - Backend compilation (handled automatically in
  Docker build)
  - **Bun runtime** - Frontend package management and Next.js server
  runtime

  ### Deployment Dependencies

  - [Rust &amp; Axum Documentation](https://docs.rs/axum)
  - [Next.js Standalone Output](https://nextjs.org/docs/app/api-referenc
  e/config/next-config-js/output)
  - [SQLx Migrations](https://github.com/launchbadge/sqlx/blob/main/sqlx
  -cli/README.md)
  - [utoipa OpenAPI Generator](https://github.com/juhaku/utoipa)

  ### Implementation Details

  The project uses a monorepo structure with automatic type generation:

  **Backend (Rust)**:
  ```rust
  // Define API types with OpenAPI schema generation
  #[derive(Serialize, Deserialize, ToSchema)]
  pub enum TodoRequest {
      List,
      Create { title: String, description: Option },
      // ... other operations
  }

  Frontend (TypeScript):
  // SDK auto-generated from OpenAPI spec
  import { ApiClient } from "@rust-react-starter/sdk";

  const client = new ApiClient({ baseUrl: API_URL });
  const response = await client.todos({ List: {} }); // Fully typed!

  Environment Variables Required:
  - DATABASE_URL - PostgreSQL connection string (auto-configured by
  Railway)
  - NEXT_PUBLIC_API_URL - Backend API URL for frontend
  - NEXT_PUBLIC_WS_URL - WebSocket endpoint URL
  - PORT - Server port (defaults to 8888 for backend, 3000 for frontend)

  ### Why Deploy rust-react-starter on Railway?

  Railway is a singular platform to deploy your infrastructure stack.
  Railway will host your infrastructure so you don't have to deal with
  configuration, while allowing you to vertically and horizontally scale
   it.

  By deploying rust-react-starter on Railway, you are one step closer to
   supporting a complete full-stack application with minimal burden.
  Host your servers, databases, AI agents, and more on Railway.
  ```

## Similar templates

- [open-excalidraw](https://railway.com/deploy/open-excalidraw) — Self-hostable collaborative drawing built on Excalidraw
- [caring-vibrancy](https://railway.com/deploy/caring-vibrancy) — Deploy and Host caring-vibrancy with Railway
- [Appsmith](https://railway.com/deploy/appsmith-1) — Low-code platform for internal tools, dashboards, and admin panels.

Open this page in a browser: https://railway.com/deploy/rust-react-starter
