This repository contains a boilerplate to start building an app prototype and focuses on implementation of business logic of the idea for your app. All configuration like DB connection, CDN storage, authentication, build pipeline, deployment, static code analysis is ready to use, so you do not have to spend time on configuration of your project.
When I was attending hackathons, I always lose time to set up my whole environment before I actually started implementing my idea. I have decided that I want to have a boilerplate that will have a preconfigured connection with DB, CDN storage, Authentication, build pipeline… . In the future, it is possible I will extend this boilerplate with features that I will be missing during hackathons.
- Configured connection with Firestore
- Configured connection with Cloud Storage for Firebase
- Functions for authentication Firebase Authentication
- Improved types for firestore
- Configured Firestore, Firebase Storage and Firebase Authentication emulators
- Configured deploy pipeline
- Configured CI/CD pipeline
- Configured TanStack Router
- Full PWA support
- Theme toggle
- Configured i18n
- Configured MUI with prepared files inside
./src/muiopen for your changes in theme, typography... - Configured Eslint and Prettier with set of rules that you can adjust to your needs
Before you will use this repository make sure that you have installed:
-
Git
-
If you are a Windows or macOS user visit this link Downloading Git then download appropriate installer and install it.
-
If you are a Linux (Arch-based distribution) user you can paste bellow scrip into your terminal or visit this page Installing Git
pacman -S git
-
-
Node.js and npm
-
If you are a Windows or macOS user visit this link Node.js download then download LTS version for Windows and install it.
-
If you are a Linux (Arch-based distribution) user you can paste bellow scrip into your terminal or visit this page Node installation instruction or use nvm
paru -S nvm nvm install node nvm use node
-
-
Java 11+
-
If you are a Windows or macOS user visit this link OpenJDK Installation and follow instructions.
-
If you are a Linux (Arch-based distribution) user you can follow this instructions OpenJDK Installation or use this command:
pacman -S openjdk
-
If you followed every step, you should be ready to start using this repository. To make sure that you have installed everything correctly open your terminal git-bash and run the following commands:
- To check git:
git --version→ you should see output with git version - To check node.js:
node --version→ you should see output with node.js version - To check npm:
npm --version→ you should see output with npm version - To check java:
javac --version→ you should see output with javac version
-
Create a fork of this project on your GitHub account
-
Open your terminal / git-bash in location where you want to create a directory which will contain this repository
-
Run the following command in your terminal / git-bash
git clone [email protected]:kaczor6418/fast-thon.git cd ./fast-thon
Once you downloaded the repository, you need to set and synchronize your Firebase project name with this repository. Otherwise, deploying firestore rules, storage rules, page deployment and CI/CD pipeline can end with errors. You can find the project ID in Project settings tab.
Then you need to run below command with project-id that you have found.
npm run firebase:link-app fast-thon-49c51
To make GitHub actions work you need to generate your personal Firebase API token and attach it as a secret inside you repository.
What you need to do:
- Open Firebase console in your web-browser
- Navigate to your Project setting
- Navigate to Service accounts
- If you do not have Service account yet, you should see a button to Create service account
- In Firebase Admin SDK find Generate new private key button and click it
- Firebase Admin SDK Key should be generated and download to your disk in
.jsonformat - Now open GitHub with fork/copy of fast-thon repository
- Open Setting tab
- Find Secrets and variables section in left navbar and choose Actions
- Find New repository secret button and click it
- As Name of your secret put
FIREBASE_SERVICE_ACCOUNT_TOKEN - Inside Secret area put content of Firebase Admin SDK
.jsonfile you have generated - Click Add secret button
- Now you should be redirected to list of your secrets, and you should see new secret in the list
- Now GitHub actions should work
To run this project locally make sure you are in root directory of fast-thon repository, and you have installed all dependencies:
npm i
Then you need to start Firebase emulators first:
npm run firebase:start:emulators
Emulator UI should be available under http://127.0.0.1:4000/
Then in separated terminal you need run the application:
npm run start
App preview should be available under http://localhost:5173/
To check documentation please visit wiki page
- To start a local web server with HMR for development
npm run start - To create production build
npm run buildIf you have errors in the terminal about not enough privileges to create some files/dirs use this command with
sudoor add needed privileges to your node_modules - To start a local web server that serves the built solution
npm run preview - To start eslint static code analysis report
npm run lint - To start eslint static doe analysis and fix all auto-fixable errors
npm run lint:fix - To start eslint static doe analysis and fix all auto-fixable errors in watch mode
npm run lint:watch - To start code formatter analysis report
npm run prettyprint - To start code formatter analysis and fix all auto-fixable errors
npm run prettyprint:fix - To integrate CI/CD pipeline with firebase project
npm run firebase:link-app [project-name] - To log in to your firebase account
npm run firebase:login - To start Authentication, Firestore and Storage emulators
npm run firebase:start:emulators - To deploy all Firestore security rules, storage security rules and Firestore indexes
npm run firebase:deploy - To deploy all storage security
npm run firebase:deploy:storage-rules - To deploy all Firestore security rules
npm run firebase:deploy:firestore-rules - To deploy all Firestore indexes
npm run firebase:deploy:firesotre-indexes - To stop tracking changes in db-seed
npm run git:stop-tracking-db-seedThis can be usefully if you pushed some changes to db-seed, and you want to keep seed ignored
- To run integration tests
npm run test:integrationRemember to run
npm run firebase:start:emulatorsbefore starting integration tests - To run integration tests and watch for changes
npm run test:integration:watchRemember to run
npm run firebase:start:emulatorsbefore starting integration tests - To run integration tests inside CI env
npm run ci:test:integration