Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Hacathon app boilerplate React+ MUI + Firebase

License

zbicin/fast-thon

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

fast-thon

  1. Description
  2. Philosophy
  3. What's inside
  4. Requirements
  5. Downloading the repository
  6. Using the repository

Description

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.

Philosophy

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.

What's inside

  • 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/mui open for your changes in theme, typography...
  • Configured Eslint and Prettier with set of rules that you can adjust to your needs

Requirements

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

Downloading the repository

  • 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

Using the repository

Connecting with Firebase project

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.

image info

Then you need to run below command with project-id that you have found.

npm run firebase:link-app fast-thon-49c51

Setting-up CI/CD

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:

  1. Open Firebase console in your web-browser
  2. Navigate to your Project setting image info
  3. Navigate to Service accounts image info
  4. If you do not have Service account yet, you should see a button to Create service account
  5. In Firebase Admin SDK find Generate new private key button and click it image info
  6. Firebase Admin SDK Key should be generated and download to your disk in .json format
  7. Now open GitHub with fork/copy of fast-thon repository
  8. Open Setting tab image info
  9. Find Secrets and variables section in left navbar and choose Actions image info
  10. Find New repository secret button and click it image info
  11. As Name of your secret put FIREBASE_SERVICE_ACCOUNT_TOKEN
  12. Inside Secret area put content of Firebase Admin SDK .json file you have generated
  13. Click Add secret button
  14. Now you should be redirected to list of your secrets, and you should see new secret in the list image info
  15. Now GitHub actions should work

Running project

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/

Documentation

To check documentation please visit wiki page

Scripts

  • To start a local web server with HMR for development
    npm run start
    
  • To create production build
    npm run build
    

    If you have errors in the terminal about not enough privileges to create some files/dirs use this command with sudo or 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-seed
    

    This 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:integration
    

    Remember to run npm run firebase:start:emulators before starting integration tests

  • To run integration tests and watch for changes
    npm run test:integration:watch
    

    Remember to run npm run firebase:start:emulators before starting integration tests

  • To run integration tests inside CI env
    npm run ci:test:integration
    

About

Hacathon app boilerplate React+ MUI + Firebase

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 62.1%
  • JavaScript 18.7%
  • Shell 16.7%
  • HTML 2.5%