- Clonar o repositório
git clone https://github.com/arquitetodev/poupig
- Instalar as dependências via terminal (dentro da pasta principal)
npm i
- Entrar em Projeto Overview / Project Settings
- Informe o nome do projeto.
- Copiar informações para o arquivo .env
Dentro do projeto frontend, renomear o arquivo .env.sample
para .env.local
NEXT_PUBLIC_FIREBASE_API_KEY=
NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN=
NEXT_PUBLIC_FIREBASE_PROJECT_ID=
- Entrar no menu build e selecionar Firestore Database
- Editar as
rules
(regras de acesso) do Firestore
rules_version = '2';
service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write: if false;
}
match /usuarios/{email} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
match /financas/{email} {
match /transacoes/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
match /recorrencias/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
match /sumarios/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
}
match /contas/{email} {
match /itens/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
}
match /cartoes/{email} {
match /itens/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
match /faturas/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
}
}
match /categorias/{email} {
match /itens/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
}
match /eventos/{id} {
allow read: if request.auth != null;
allow write: if request.auth != null;
}
match /extratos/{email} {
match /mensais/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
match /transacoes/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
}
match /recorrencias/{id} {
allow read: if request.auth != null && request.auth.token.email == email;
allow write: if request.auth != null && request.auth.token.email == email;
}
}
}
}
- Configurar autenticação com
Google
- (Opcional) Depois pode repetir os processos para
Facebook
eYahoo
-
Entrar no Menu
Build
>Functions
-
Vai precisar habilitar a parte de faturamento, mas NÃO será cobrado nada de início. A cobrança é pelo uso e tem uma boa camada gratuita.
- Eu usei uma conta já configurada, mas se não tiver vai precisar criar uma nova conta de faturamento
- Colocar um valor para ser notificado quando chegar nesse valor, mas isso só vai ocorrer de a aplicação tiver muito uso
- Finalizar a conversão para o plano
Blazer
- Agora é clicar em
Get started
- Continue
- Finalizar
- Instalar via terminal o CLI do firebase
npm i -g firebase-tools
- Executar o login via CLI do firebase
firebase login
- Depois de executar o login é solicitado via browser para selecionar a conta
- Permitir o CLI ter acesso a sua conta no firebase
- Mensagem de sucesso
- Executar o comando no terminal para listar os projetos
firebase projects:list
- No terminal entre na pasta
apps/backend
# dentro da pasta do projeto
cd apps/backend
- Selecione o projeto usando o seu número
firebase use <numero-do-projeto>
Entrar Console do Google Cloud
- Selecione o projeto correto e vamos criar um
topic
- Criar um
topic
com nome deextrato-alterado
- Dentro da pasta do projeto
backend
executar o seguinte comando no terminal
npm run deploy
- Dentro da pasta principal do projeto
npm run dev