Looking for the older version of Starter Kit? Check out the
v2branch.
A technical kit to quickly build new products from Open Government Products, Singapore.
- πΌ Monorepo setup with Turborepo
- π§ββοΈ E2E typesafety with tRPC v11
- β‘ Full-stack React with Next.js v15
- π Database with Prisma
- βοΈ VSCode extensions
- π¨ ESLint + Prettier
- π CI setup using GitHub Actions:
- β E2E testing with Playwright
- β Unit testing with Vitest
- β Visual regression testing with Storybook + Chromatic
- β Linting
- β Type checking
- π Env var validation
.github
ββ workflows
ββ CI with pnpm cache setup
.vscode
ββ Recommended extensions and settings for VSCode users
apps
ββ web
ββ Next.js 15
ββ React 19
ββ Tailwind CSS v4
ββ E2E Typesafe API Server & Client
packages
ββ db
β ββ Typesafe db calls using Prisma
ββ ui
ββ Start of a UI package for the webapp using react-aria-components + @opengovsg/oui
tooling
ββ eslint
β ββ shared, fine-grained, eslint presets
ββ prettier
β ββ shared prettier configuration
ββ tailwind
β ββ shared tailwind theme and configuration
ββ typescript
ββ shared tsconfig you can extend from
You may work on the codebase with:
- A GitHub Codespace provided by us, or;
- With your local machine.
Follow the official GitHub guide for developing with a codespace.
In summary:
- Clone the repository to your local machine
- Follow instructions for running the app locally
# Install dependencies
pnpm i
# Configure environment variables
# There is an `.env.example` in the root directory you can use for reference
cp .env.example .env.local
# Start docker containers
# use `docker compose down` to stop the containers afterwards
docker compose up -d
# Push the Prisma schema to the database
pnpm db:pushOptionally set POSTMAN_API_KEY to send login OTP emails via Postman.
If not set, OTP emails will be logged to the console instead.
NEXT_PUBLIC_ to ensure that the variable is exposed to the browser. For example, if you want to add a variable called MY_ENV_VAR, you should add it to your .env file as NEXT_PUBLIC_MY_ENV_VAR.
You will also need to update the various environment files (like apps/web/src/env.ts or packages/db/src/env.ts) to explicitly reference the variable so NextJS will correctly bundle the environment variable into the client-side bundle.
To add a new package, simply run pnpm turbo gen init in the monorepo root. This will prompt you for a package name as well as if you want to install any dependencies to the new package (of course you can also do this yourself later).
The generator sets up the package.json, tsconfig.json and a index.ts, as well as configures all the necessary configurations for tooling around your package such as formatting, linting and typechecking. When the package is created, you're ready to go build out the package.
Follow these instructions if you are familiar with building applications, and/or are in a hurry to prepare an environment to work on your product.
If you are new, see our Getting Started guide.
If you are exploring what else you can do with Starter Kit, a more comprehensive set of documentation, including guides and tutorials, can be found here.
The Vercel deployment outlined below is optimised for quick prototyping and development. It is not recommended for serious production use.
For serious production use cases, consider directly deploying Starter Kit to AWS. We provide a command line interface (CLI) tool (for internal use only) that can help you deploy Starter Kit to a standardised AWS infrastructure.
Nonetheless, on low-risk production use cases, Vercel can still be used as a production deployment. We have a document on when one might want to migrate to AWS here.
Let's deploy the Next.js application to Vercel. If you've never deployed a Turborepo app there, don't worry, the steps are quite straightforward. You can also read the official Turborepo guide on deploying to Vercel.
-
Create a new project on Vercel, select the
apps/webfolder as the root directory. Vercel's zero-config system should handle all configurations for you. -
Add the prerequisite environment variables outlined in the Prerequisites section.
-
Done! Your app should successfully deploy.
The deployment needs a few environment variables to be set for it to function. They are:
| Name | What It Is | Example |
|---|---|---|
DATABASE_URL |
The connection string for your database. This should have been obtained from Neon | postgresql://user:[email protected]/app?sslmode=require |
POSTMAN_API_KEY |
An API key to send email via Postman | asdfn_v1_6DBRljleevjsd9DHPThsKDVDSenssCwW9zfA8W2ddf/T |
SESSION_SECRET |
A sequence of random characters used to protect session identifiers, generated by running npx uuid from your terminal |
66a21b98-fb17-4259-ac4f-e94d303ac894 |
The stack originates from create-t3-app and create-t3-turbo with some additional OGP-specific tweaks.