Hi πthis is full stack app version 2.0, check out the previous repo π Form Hub, which used docker to run the frontend and backend in two separate repo. This repo is using Turborepo to run the frontend and backend in one repo. The docker setup is still there, but restructured the whole app to use turborepo.
Fun fact, turborepo is created by the same person who created Nextjs.
Install the required dependencies with yarn install
in the root
folder, frondend
folder and backend
folder.
Go to the root folder, run yarn dev
and docker-compose up
to start the app.
- When you move the backend and frontend to monorepo, the first two things: 1 delete git root and node_modules, 2 change the package name in package.json.
- Turbo setting for frontend, we only want to build and run the things we required for frontend.
"build": "turbo run build --filter=frontend",
"dev": "turbo run dev --filter=frontend --parallel",
Very exciting, this monorepo full stack app is working with many new features, I would like to summarize their functions for this app and build whole app structure for better understanding.
There is alter in Github "Your repository has dependencies with security vulnerabilities." I think it is because of the turborepo, I will continue to troubleshoot this issues. π©βπ§
Update: the dependencies issues is fixed, have fun dependabot[bot] helped me update everything antomatically. GitHub is an amazing playground π
π Hope this repo can help you to understand how to use turborepo to build a full stack app.
The following is from the original Turborepo introduction
This is an official Yarn v1 starter turborepo.
This turborepo uses Yarn as a package manager. It includes the following packages/apps:
docs
: a Next.js appweb
: another Next.js appui
: a stub React component library shared by bothweb
anddocs
applicationseslint-config-custom
:eslint
configurations (includeseslint-config-next
andeslint-config-prettier
)tsconfig
:tsconfig.json
s used throughout the monorepo
Each package/app is 100% TypeScript.
This turborepo has some additional tools already setup for you:
- TypeScript for static type checking
- ESLint for code linting
- Prettier for code formatting
To build all apps and packages, run the following command:
cd my-turborepo
yarn run build
To develop all apps and packages, run the following command:
cd my-turborepo
yarn run dev
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:
cd my-turborepo
npx turbo login
This will authenticate the Turborepo CLI with your Vercel account.
Next, you can link your Turborepo to your Remote Cache by running the following command from the root of your turborepo:
npx turbo link
Learn more about the power of Turborepo: