Git Product home page Git Product logo

web-app-boilerplate's Introduction

Web Application Boilerplate

This template provides a minimal setup to start developing web application.

Stack

  • React
  • Typescript
  • Vite
  • Tailwind
  • Firebase
  • Zustand

How to start

Clone this repository to your local machine:
git clone https://github.com/StasPonomaryov/web-app-boilerplate.git

Install dependencies:
pnpm i

Edit vite.config.ts for outDir (path to build) and base (path to run).

Create .env.local, .env.staging, .env.production files for local development\staging\production and place there some variables and put Firebase credentials there:

VITE_APP_FAVICON_EMOJI="๐Ÿ‘‘"
VITE_APP_TITLE="Web App Boilderplate [local]"
VITE_APP_HOME_FOLDER="/web-app"
VITE_APP_FIREBASE_API_KEY=""
VITE_APP_FIREBASE_AUTH_DOMAIN=""
VITE_APP_FIREBASE_DATABASE_URL=""
VITE_APP_FIREBASE_PROJECT_ID=""
VITE_APP_FIREBASE_STORAGE_BUCKET=""
VITE_APP_FIREBASE_MESSAGING_SENDER_ID=""
VITE_APP_FIREBASE_APP_ID=""
NODE_ENV=<development|production>

How to run

Run local:
pnpm run dev

How to build

Build staging:
pnpm build:stage

Build production:
pnpm build

How to deploy

โš ๏ธ IMPORTANT. Every your deployment will remove ALL files on Firebase hosting. Therefore, if you have multiple applications placed in subdirectories like public/web-app, public/web-app-2 you'll lose all of them and only current application will be available.

โš ๏ธ You must have firebase-tools installed on your machine globally

  1. If your Firebase hosting contsins ONLY one (this) application:

Create .firebaserc file and put there info about your projects:

{
  "projects": {
    "prod": "web-app",
    "dev": "web-app-dev",
    "default": "web-app-dev"
  }
}

Create firebase.json file and put there info about your projects' hosting:

{
  "hosting": {
    "public": "public",
    "ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
    "rewrites": [
      {
        "source": "/web-app/**",
        "destination": "/web-app/index.html"
      }
    ]
  }
}

Deploy to Firebase hosting (staging project) firebase deploy --only hosting -P dev

Deploy to Firebase hosting (production project) firebase deploy --only hosting -P prod

  1. If you have multiple applications on your Firebase hosting:

In your vite.config.ts pleace full path to your project hosting in outDir. E.g. ../../projects/newproject/public/

Add to file firebase.json in your project this data to hosting.rewrites array:

{
  "source": "/web-app/**",
  "destination": "/web-app/index.html"
}

Build your application and check if it built in proper folder of your project.

From your project run hosting deployment:
firebase deploy --only hosting -P <project_name>

web-app-boilerplate's People

Contributors

stasponomaryov avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.