A full-stack monorepo starter kit powered by Turborepo, originally based on Turborepo example kitchen-sink.
This starter kit is already pre-configured with some additional packages and tools, such as:
- Typescript for static type checking
- Fastify for the REST or GraphQL API
- Next.js for the frontend
- Tailwind CSS for the styling the frontend
- ESLint for code linting
- Prettier for code formatting
- tsup TypeScript library bundler powered by esbuild
- Jest test runner for all things JavaScript
Minio for S3 storage backend- Garage S3 for S3 storage backend
Each package and app is 100% TypeScript.
- Install Node.js
v18.16.1
or greater: https://nodejs.org/en/download - Install
pnpm
package manager: https://pnpm.io/installation - Docker and Docker Compose: https://docs.docker.com/desktop
# Using npx
npx create-turbo@latest -e https://github.com/riipandi/fuelstack
# Using yarn
yarn create-turbo@latest -e https://github.com/riipandi/fuelstack
# Using pnpm
pnpm dlx create-turbo@latest -e https://github.com/riipandi/fuelstack
The organization scope for this starter is @acme
. To change this, you'll need to do the following:
- Rename folders in
packages/*
to replaceacme
with your desired scope. - Search and replace
acme
string with your desired scope.
Before you continue, you need to create .env
file (you can duplicate .env.example
) and
fill the application secret key
with some random string. To generate a secret key, use
the following command:
openssl rand -base64 500 | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1
This turborepo uses pnpm as a package manager.
Run pnpm install
to install required npm dependencies.
Start all packages in development
pnpm dotenv -e .env.local -- turbo run dev
Run or build partial apps or package
# Running the Fastify API in development mode
pnpm dotenv -e .env.local -- turbo run dev --filter=api...
# Running the Next.js application in development mode
pnpm dotenv -e .env.local -- turbo run dev --filter=website...
# Build the Next.js application for production
pnpm dotenv -e .env.local -- turbo run build --filter=website...
For more detailed explanation, check out Turborepo documentation.
Turborepo's team currently recommend
using dotenv-cli
as the simplest way to bring your environment variables into your development tasks.
Turborepo's team looking forward to improving the developer experience and ergonomics for your
environment variables in a future release of Turborepo.
Turborepo can use a technique known as Remote Caching to share cache artifacts across machines, enabling you to share build caches with your team and CI/CD pipelines.
By default, Turborepo will cache locally. To enable Remote Caching you will need an account with Vercel. If you don't have an account you can create one, then enter the following commands:
# Authenticate the Turborepo CLI with your Vercel account
pnpm dlx turbo login
# Link your project to your Remote Cache
pnpm dlx turbo link
This starter contains a command line script to help you manage the project such as running the PostgreSQL, Redis, and Mailpit on Docker.
pnpm dev # Develop all packages and the docs site
pnpm build # Build all packages and the docs site
pnpm lint # Lint all packages
pnpm cleanup # Clean up all node_modules and dist folders
docker build -f apps/website/Dockerfile . --no-cache \
-t acme-website:$(npm pkg get version | tr -d "\042") \
-t acme-website:latest
If you want to use Turbo caching:
docker build -f apps/website/Dockerfile . --no-cache \
--build-arg TURBO_TEAM="your_team_name" \
--build-arg TURBO_TOKEN="your_token" \
-t acme-website:$(npm pkg get version | tr -d "\042") \
-t acme-website:latest
docker run --rm -it --name acme-website -p 3000:3000 \
--env-file .env.docker acme-website:latest
For more detailed explanation, check out Deploying with Docker documentation.
You'll want to fork this repository and deploy your own Next.js website. Once you have an image generator that sparks joy, you can setup automatic GitHub deployments so that pushing to master will deploy to production! ๐
You will need to configure a few things:
- Settings -> General -> Root Directory :
apps/website/
- Settings -> Git -> Ignored Build Step :
git diff --quiet HEAD^ HEAD ./
Ignored Build Step configuration used to avoid rebuilding on Vercel when pushing the changes. So, Vercel will deploy only when any changes on the specific directory.
You need to add NODE_VERSION
with value 18.16.1
on the environment variables setting.
In general, I'd like to thank every single one who open-sources their source code for their effort to contribute something to the open-source community. Your work means the world! ๐ โค๏ธ
Learn more about the power of Turborepo:
- Turborepo documentation
- Next.js documentation
- Fastify documentation
- Working with the Github npm registry
This project is open-sourced software licensed under the MIT license.
Copyrights in this project are retained by their contributors. See the license file for more information.
๐คซ Psst! If you like my work you can support me via GitHub sponsors.