A highly opinionated, modern, production-ready template for building full-stack React applications using React Router.
- 🚀 Server-side rendering
- ⚡️ Hot Module Replacement (HMR)
- 📦 Asset bundling and optimization
- 🔄 Data loading and mutations
- 🔒 TypeScript by default
- 🎉 TailwindCSS for styling
- 📖 React Router docs
Install the dependencies:
bun installStart the development server with HMR:
bun run devYour application will be available at http://localhost:5173.
Preview the production build locally:
bun previewCreate a production build:
bun buildDeployment is done using the Wrangler CLI.
To build and deploy directly to production:
bun deployTo deploy a preview URL:
bunx wrangler versions uploadYou can then promote a version to production after verification or roll it out progressively.
bunx wrangler versions deployALCHEMY_PASSWORD=your-encryption-password
ALCHEMY_STATE_TOKEN=your-state-token
CLOUDFLARE_API_TOKEN=your-cloudflare-api-token
CLOUDFLARE_EMAIL=your-cloudflare-emailin Settings -> Secrets -> Actions -> New repository secret.
# add environment secrets to github
gh secret set -f .env.example (--env production | --env staging)
# add repository secrets to github
gh secret set -f .env.exampleNow add 'production' and 'staging' environments in github as well, by going to Settings -> Environments -> New environment. Add secrets there. You will no longer manage secrets in the workers dashboard, it will all be consolidated here.
Make sure to add the secrets to deploy.yml as well.
all preview environments (PRs) will use the staging environment variable.
Now add the newly added secrets to the github actions workflow under env.
PUBLIC_ secrets are meant to be public, so you can just hardcode them in alchemy.run.ts
Secrets will no longer be managed in the workers dashboard, it will all be consolidated here.
- Add a secret to
.env - Add a the secret with a placeholder value in
.env.example - Add the newly added secret under
ReactRoutersbindingsinalchemy.run.ts. If its a secret, usealchemy.secret(process.env.SECRET). If its a public value, useprocess.env.PUBLIC_VALUEwith a default value. - Add the newly added secret under
deploy.ymlunderenv. - Lastly, add the newly added secret to both
stagingandproductionenvironments in github.
- Uses opencode as the AI agent. Make sure to have the opencode CLI installed with opencode zen.
- Open opencode from the root of the project, and run
/scaffold {description of the project}to have it create a base UI for the project. - Ralph scripts are under
/scripts. If you plan to use it, make sure thatplans/prd.jsonis filled in with the project's PRD.
This template comes with Tailwind CSS already configured for a simple default starting experience. You can use whatever CSS framework you prefer.
bunx ultracite init # install ultraciteand follow the prompts.
Built with ❤️ using React Router.