In your project folder use this to install:
git clone https://github.com/holasoycael/boilerplate-firebase-functions.git . && rm -rf ./.git && git init && git branch -M main && git add . && git commit -m "Initial commit"
Now just add your remote repository β¨
In the folder above functions use the command below to start the emulators:
firebase emulators:start --import=./data --export-on-exit=./data
To listen for changes inside the VSCode use the command:
yarn build --watch
To use path alias
in your project ensure it is seen by both TypeScript and Babel. This will ensure that we have them in our text editor and the transpiler will know where they are.
Follow the examples below example:
tsconfig.json
{
"__comment_above__": "code above for example...",
"baseUrl": ".",
"paths": {
"@controllers/*": ["./src/controllers/*"],
"@routes/*": ["./src/routes/*"],
"@configs/*": ["./src/configs/*"],
"@middlewares/*": ["./src/middlewares/*"],
"@modules/*": ["./src/modules/*"],
"@models/*": ["./src/models/*"],
"@typings/*": ["./src/typings/*"],
"@utils/*": ["./src/utils/*"]
},
"__comment_below__": "code below for example...",
}
babel.config.js
module.exports = {
// code ...
plugins: [
['module-resolver', {
alias: {
'@controllers': './src/controllers',
'@utils': './src/utils',
'@configs': './src/configs',
'@middlewares': './src/middlewares',
'@modules': './src/modules',
'@models': './src/models',
'@typings': './src/typings',
'@routes': './src/routes'
}
}]
],
// code ...
}
Now the project is ready to use π₯
functions
βββ .vscode
β βββ settings.json
βββ node_modules
βββ src
β βββ configs
β β βββ firebase.ts
β β βββ serviceAccount.json
β βββ controllers
β β βββ HelloController.ts
β βββ middlewares
β β βββ Default
β β β βββ handle.ts
β β β βββ store.ts
β β βββ `PascalCase`
β β βββ handle.ts
β β βββ store.ts
β βββ models
β β βββ `PascalCase`
β β βββ index.ts
β βββ modules
β β βββ auth.ts
β β βββ firestore.ts
β β βββ realtime.ts
β βββ routes
β β βββ `PascalCase`
β β βββ index.tsx
β βββ tests
β βββ typing
β β βββ Default.ts
β β βββ Hello.ts
β β βββ User.ts
β βββ utils
β β βββ jwt.ts
β βββ index.ts
βββ .editorconfig
βββ .eslintignore
βββ .eslintrc.js
βββ .gitignore
βββ .prettierignore
βββ .prettierrc
βββ babel.config.js
βββ package.json
βββ README.md
βββ tsconfig.dev.json
βββ tsconfig.json
βββ yarn.lock