Experience the ultimate social truth or dare game - see, chat, and react together with up to 8 friends!
We have moved to a monorepo for our project, which is a version control repository that contains all of the code for our project in a single location. This is different from the traditional approach, where each application or package would have its own separate repository.
- apps
- services # Backend services (Express.js)
- web # Frontend web (Next.js)
- packages
- api # API utils (Axios)
- config # Shared config of tailwind, postcss, prettier and many more.
- database # Database utils (Prisma)
- gifpicker # Gif picker component (React, powered by Tenor)
- helpers # Helper functions used both in backend and frontend
- responses # Response utils (Express.js)
- socket # Socket utils types (Socket.io) and events that are used in both backend and frontend
- truth-or-dare # Separate package for data cleansing truth and dares
- output # Output folder for all the truth and dares (re-run the build to update the data)
- ui # UI components (React)Since this project is built using TypeScript, it is important to add the tsconfig.json file to the root of the package.
- Create a
package.jsonin the directory and prepend the package name with@troof/(e.g.@troof/math). This will be used to reference the package in other packages. - Add the
tsconfig.jsonfile to the root of the package. This will be used to compile the TypeScript code to JavaScript. - Back in the
package.jsonfile, add thebuildanddevscripts. Thebuildscript will be used to compile the TypeScript code to JavaScript and thedevscript will be used to watch for changes in the TypeScript code and compile it to JavaScript. - Add the
mainandtypesfields to thepackage.jsonfile. Themainfield will be used to reference the compiled JavaScript code and thetypesfield will be used to reference the TypeScript type definitions. - Add the
privatefield to thepackage.jsonfile and set it totrue. This will prevent the package from being published to the npm registry and also to allow for successful installation of the package in other packages. - Run
yarn devin the root folder of the package to start watching for changes in the TypeScript code and compile it to JavaScript. - In another package that needs
@troof/math, include it in thepackage.jsonfile and runyarnto install the package.
{
"dependencies": {
"@troof/math": "*"
}
}- Remember to lint, test and run the package before pushing it to deployment.
The main commands can be read in the main package.json file. Each turbo run <X> command will run <X> in each repository if found. So example web and admin has a turbo run dev command, which will run dev in both repositories.
