Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions .idea/.idea.Fin-Backend/.idea/dataSources.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/.idea.Fin-Backend/.idea/data_source_mapping.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions .idea/.idea.Fin-Backend/.idea/git_toolbox_prj.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file added .vs/Fin-Backend/DesignTimeBuild/.dtbcache.v2
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added .vs/Fin-Backend/v17/.futdcache.v2
Binary file not shown.
Binary file added .vs/Fin-Backend/v17/.suo
Binary file not shown.
394 changes: 394 additions & 0 deletions .vs/Fin-Backend/v17/DocumentLayout.json

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file added .vs/ProjectEvaluation/fin-backend.strings.v9.bin
Binary file not shown.
67 changes: 67 additions & 0 deletions DOCKER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
[🇧🇷 Em portugês](./assets/DOCKER_pt-br.md)


# Docker Compose - Fin Backend Infrastructure

## How to run PostgreSQL and Redis databases

1. **Start the services (PostgreSQL + Redis):**
```
docker compose up -d
```
This will create the following containers:

**PostgreSQL:**
- Container: `fin_app`
- Database: `fin_app`
- User: `fin_app`
- Password: `fin_app`
- Port: `5432`

**Redis:**
- Container: `fin_redis`
- Port: `6379`
- Version: Redis 7 (Alpine)

**Check if the containers are running:**
```
docker ps -a
```

2. **Configure the connection strings in your `appsettings.json`:**
**To run the application locally:**
```json
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=fin_app;Username=fin_app;Password=fin_app"
},
"ApiSettings": {
"Redis": "localhost:6379"
}
```

3. **Verify everything is ok:**
```
dotnet build
```

4. **Start the application:**
```
dotnet run --project .\Fin.Api\
```
---
## Notes

### PostgreSQL
- The PostgreSQL container can be accessed via any PostgreSQL client on port `5432`.
- Entity Framework Core migrations create all necessary tables for all project domains.

### Redis
- Redis is used for caching and sessions in the project.
- Default port: `6379`
- Redis data is persisted in the `redis_data` volume
- Health check configured to verify if the service is active

### Development
- The `dotnet build` command checks if the project compiles correctly.
- The `dotnet run` command starts the API.
- Make sure both PostgreSQL and Redis are running before starting the application.
4 changes: 4 additions & 0 deletions Fin-Backend.sln.DotSettings.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=39a47a06_002D7915_002D4eea_002D991a_002D44cb9c74b08f/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="All tests from Solution" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
&lt;Solution /&gt;
&lt;/SessionState&gt;</s:String></wpf:ResourceDictionary>
6 changes: 6 additions & 0 deletions Fin.Api/Fin.Api.csproj.user
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ActiveDebugProfile>https</ActiveDebugProfile>
</PropertyGroup>
</Project>
4 changes: 2 additions & 2 deletions Fin.Api/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
}
},
"ConnectionStrings": {
"DefaultConnection": "EXEMPLE"
"DefaultConnection": "Host=localhost;Port=5432;Database=fin_app;Username=fin_app;Password=fin_app"
},
"AllowedHosts": "*",
"ApiSettings": {
"Redis": "EXEMPLE",
"Redis": "localhost:6379",
"Version": "EXEMPLE",
"EmailSender": {
"EmailAddress": "EXEMPLE",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[Em portugês](./assets/README_pt-br.md)
[🇧🇷 Em portugês](./assets/README_pt-br.md)

## Overview
FinApp is a modern, intuitive personal finance management solution designed to help young adults and teenagers take control of their finances. This backend provides secure, scalable APIs powering Fin’s web and mobile experiences, replacing traditional spreadsheets with a more engaging and accessible digital approach.
Expand Down
115 changes: 115 additions & 0 deletions assets/DOCKER_pt-br.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
[🇺🇸 In english](../DOCKER.md)

# Docker Compose - Fin Backend Infrastructure

## Como rodar o banco de dados PostgreSQL e Redis

1. **Suba os serviços (PostgreSQL + Redis):**
```
docker compose up -d
```
Isso irá criar os seguintes containers:

**PostgreSQL:**
- Container: `fin_app`
- Banco: `fin_app`
- Usuário: `fin_app`
- Senha: `fin_app`
- Porta: `5432`

**Redis:**
- Container: `fin_redis`
- Porta: `6379`
- Versão: Redis 7 (Alpine)

**Verificar se os containers estão rodando:**
```
docker ps -a
```

2. **Configure as connection strings no seu `appsettings.json`:**
**Para rodar a aplicação localmente:**
```json
"ConnectionStrings": {
"DefaultConnection": "Host=localhost;Port=5432;Database=fin_app;Username=fin_app;Password=fin_app"
},
"ApiSettings": {
"Redis": "localhost:6379"
}
```

3. **Verifique se tudo está ok:**
```
dotnet build
```

4. **Inicie a aplicação:**
```
dotnet run --project .\Fin.Api\
```
---
## Observações

### PostgreSQL
- O container do PostgreSQL pode ser acessado via qualquer cliente PostgreSQL na porta `5432`.
- As migrations do Entity Framework Core criam todas as tabelas necessárias para todos os domínios do projeto.

### Redis
- O Redis é usado para cache e sessões no projeto.
- Porta padrão: `6379`
- Os dados do Redis são persistidos no volume `redis_data`
- Health check configurado para verificar se o serviço está ativo

### Desenvolvimento
- O comando `dotnet build` verifica se o projeto está compilando corretamente.
- O comando `dotnet run` inicia a API.
- Certifique-se de que tanto PostgreSQL quanto Redis estejam rodando antes de iniciar a aplicação.

**Se já possui o banco e Redis configurados, utilize suas variáveis de ambiente em um `.env`:**
```json
"ConnectionStrings": {
"DefaultConnection": "Host=${POSTGRES_HOST};Port=${POSTGRES_PORT};Database=${POSTGRES_DB};Username=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
},
"ApiSettings": {
"Redis": "${REDIS_HOST}:${REDIS_PORT}"
}
```

**Exemplo de arquivo `.env`:**
```env
POSTGRES_HOST=localhost
POSTGRES_PORT=5432
POSTGRES_DB=fin_app
POSTGRES_USER=fin_app
POSTGRES_PASSWORD=fin_app
REDIS_HOST=localhost
REDIS_PORT=6379
```

---
## Comandos úteis

**Para parar os serviços:**
```
docker compose down
```

**Para parar e remover volumes (CUIDADO: apaga os dados):**
```
docker compose down -v
```

**Para ver os logs dos containers:**
```
docker compose logs -f
```

**Para conectar diretamente ao PostgreSQL:**
```
docker exec -it fin_app psql -U fin_app -d fin_app
```

**Para conectar diretamente ao Redis:**
```
docker exec -it fin_redis redis-cli
```
2 changes: 1 addition & 1 deletion assets/README_pt-br.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[In english](../README.md)
[🇺🇸 In english](../README.md)

## Visão Geral

Expand Down
38 changes: 38 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
version: '3.8'

services:
postgres:
image: postgres:16
container_name: fin_app
restart: always
environment:
POSTGRES_DB: fin_app
POSTGRES_USER: fin_app
POSTGRES_PASSWORD: fin_app
ports:
- "5432:5432"
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U fin_app"]
interval: 10s
timeout: 5s
retries: 5

redis:
image: redis:7-alpine
container_name: fin_redis
restart: always
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5

volumes:
postgres_data:
redis_data:
45 changes: 0 additions & 45 deletions notifications.md

This file was deleted.

Loading