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
81 changes: 81 additions & 0 deletions .github/workflows/app-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: App CI

on:
push:
branches: [main]
paths:
- 'app/**'
- '.github/workflows/app-ci.yml'
pull_request:
paths:
- 'app/**'
- '.github/workflows/app-ci.yml'

env:
FLUTTER_VERSION: '3.50.0'

defaults:
run:
working-directory: app

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- run: flutter pub get
- run: flutter analyze

test:
name: Tests
runs-on: ubuntu-latest
timeout-minutes: 15
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- run: flutter pub get
- run: flutter test

build-android:
name: Build Android
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: zulu
java-version: '17'
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- run: flutter pub get
- run: flutter build apk --debug --flavor dev --dart-define-from-file=env/dev.json
- run: flutter build apk --release --flavor prod --dart-define-from-file=env/prod.json

build-ios:
name: Build iOS
runs-on: macos-latest
timeout-minutes: 40
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ env.FLUTTER_VERSION }}
channel: stable
cache: true
- run: flutter pub get
- run: flutter build ios --debug --no-codesign --dart-define-from-file=env/dev.json
9 changes: 9 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ composer check # pint + phpstan (nível 8) + rector --dry-run + pest
composer audit
```

App (`app/`):

```bash
cd app
flutter analyze
flutter test
```

Front-admin e front-public (os mesmos comandos nos dois):

```bash
Expand All @@ -44,6 +52,7 @@ O CI (`.github/workflows/`) roda os mesmos comandos em todo PR — rodar localme
## Convenções

- **Backend**: módulo novo é `php artisan make:module <Nome>` seguido de `composer update phpeste/<nome>` — nunca uma pasta solta colada em `app/`. Ver `backend/CLAUDE.md` para a estrutura de pastas de um módulo (`Models/Actions/Data/Events/Listeners/Contracts/Http`) e a regra de isolamento entre módulos.
- **App**: feature nova pela skill `new-feature` (brick do Mason), no formato de `lib/src/app/features/auth/`. Ver `app/CLAUDE.md`.
- **Front-admin e front-public**: módulo novo segue o formato de `app/modules/login/` (types → services → composables → components → views). Ver o `CLAUDE.md` e o `docs/ARCHITECTURE.md` de cada um. As telas do painel seguem o [design do admin](https://claude.ai/artifact/3B7ZWqjBQPDFZ5vhGgNs4N#page-dcb81aee8d83).
- Commits em português, description curta e no imperativo (ex.: "Adiciona X", "Corrige Y").
- PRs pequenos e focados batem mais rápido do que um PR gigante — quando der, prefira quebrar em commits/PRs por assunto.
Expand Down
23 changes: 16 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Plataforma única para organizar o [PHPeste](https://phpeste.dev), o evento anua

A primeira edição a usar a plataforma é o PHPeste 2027, em João Pessoa (PB), organizado pela comunidade PHP-PB.

> **Status (27/11/2026):** Marcos 0, 1 e 2 concluídos. Já funcionam o núcleo (comunidades, edições, equipe, identidade visual, domínios), o CFP completo, a venda de ingressos com Pix e cartão no gateway da própria comunidade, e a gestão da organização (patrocinadores, fornecedores, finanças, tarefas, modelos de e-mail). No site da edição já existem o formulário do CFP, a área do palestrante, o checkout e a conta do participante. Próximo: Marco 3 (programação, check-in, site da edição e checkout embutível). O `app` (Flutter) ainda não foi iniciado.
> **Status (27/11/2026):** Marcos 0, 1 e 2 concluídos. Já funcionam o núcleo (comunidades, edições, equipe, identidade visual, domínios), o CFP completo, a venda de ingressos com Pix e cartão no gateway da própria comunidade, e a gestão da organização (patrocinadores, fornecedores, finanças, tarefas, modelos de e-mail). No site da edição já existem o formulário do CFP, a área do palestrante, o checkout e a conta do participante. Próximo: Marco 3 (programação, check-in, site da edição e checkout embutível) e o app mobile (Marco 5), cuja base já está em `app/`.

## Por que esta plataforma existe

Expand Down Expand Up @@ -37,12 +37,13 @@ Pronto:
- **Site da edição:** formulário do CFP e área do palestrante; checkout com Pix e cartão; conta do participante com os ingressos (o QR abre sem internet), crachá, transferência e histórico de pedidos.
- **Gestão da organização:** patrocinadores (funil, cotas e entregas), fornecedores (cadastro global e contratos por edição), finanças (receitas, despesas, orçamento), tarefas (kanban com lembretes), modelos de e-mail por edição e trilha de auditoria.

A fazer (Marcos 3 e 4, ver o [board](https://github.com/orgs/PHPeste/projects/2)):
A fazer (Marcos 3, 4 e 5, ver o [board](https://github.com/orgs/PHPeste/projects/2)):

- **Programação:** salas, sessões, grade com validação de conflitos e agenda pessoal.
- **Check-in:** leitura de QR no credenciamento, com modo offline.
- **Site da edição completo** (template, SEO, termos e LGPD) e **checkout embutível** no site da comunidade.
- **Push, app do participante**, feedback, certificados, sorteio, relatórios e operação (carga, backups, runbook).
- **App mobile** (Marco 5): um app só para participante (início, programação, agenda, ingresso que abre sem internet, transferência, notificações), palestrante (propostas e confirmação) e equipe (check-in com leitura de QR, busca e fila offline).
- **Push**, feedback, certificados, sorteio, relatórios e operação (carga, backups, runbook).

## Princípios

Expand All @@ -59,7 +60,7 @@ A fazer (Marcos 3 e 4, ver o [board](https://github.com/orgs/PHPeste/projects/2)
| Documentação da API | [Scramble](https://github.com/dedoc/scramble) (OpenAPI) |
| Admin | Nuxt, a partir do [base_nuxt_modular](https://github.com/tecrodrigocastro/base_nuxt_modular) |
| Site público e checkout | Nuxt (SSR) |
| App do participante | Flutter, a partir do [base_clean_arch_bloc](https://github.com/tecrodrigocastro/base_clean_arch_bloc) |
| App mobile | Flutter 3.50, a partir do [base_clean_arch_bloc](https://github.com/tecrodrigocastro/base_clean_arch_bloc) (clean architecture com BLoC) |
| Autenticação | Laravel Sanctum (token Bearer) |
| Filas e cache | Redis |
| Qualidade | Pint, Larastan, Pest e Playwright |
Expand All @@ -73,7 +74,7 @@ phpeste-platform/
├── backend/ # Laravel: API, filas, webhooks (módulos em app-modules/)
├── front-admin/ # Nuxt: painel da organização
├── front-public/ # Nuxt SSR: área do palestrante e participante, checkout e site da edição, por host (ou só a área, quando a comunidade tem site próprio)
└── app/ # (planejado, ainda sem marco) Flutter: app do participante
└── app/ # Flutter: app do participante, palestrante e equipe de check-in
```

## Módulos do backend
Expand Down Expand Up @@ -144,8 +145,15 @@ composer update phpeste/<nome>
curl -H 'X-Forwarded-Host: <domínio da edição>' http://localhost:3000/
```

Os testes dos três projetos rodam com `npm test` e `npm run test:e2e` (Playwright, com a API simulada) nos fronts e `composer check` no backend; o CI roda os mesmos comandos em todo PR.
- **App** (`app/`): ainda não iniciado.
Os testes dos fronts e do backend rodam com `npm test` e `npm run test:e2e` (Playwright, com a API simulada) nos fronts e `composer check` no backend; o CI roda os mesmos comandos em todo PR.
- **App** (`app/`): base pronta; as telas entram no Marco 5.

```bash
cd app
flutter pub get
flutter run --flavor dev --dart-define-from-file=env/dev.json # emulador Android, API local em 10.0.2.2:8000
flutter analyze && flutter test
```

## Documentação

Expand All @@ -159,6 +167,7 @@ Tudo o que não cabe neste README fica em [`docs/`](docs/):
- [`deploy/dominios-e-tls.md`](docs/deploy/dominios-e-tls.md): proxy, domínios das edições e certificados
- [`adr/`](docs/adr/): o porquê de cada decisão de arquitetura (0001–0009)
- [Design do admin](https://claude.ai/artifact/3B7ZWqjBQPDFZ5vhGgNs4N#page-dcb81aee8d83): protótipo das telas do `front-admin`
- [Design do app](https://claude.ai/artifact/3yAeWXmnxFSdActqPdqt7K#page-dcb81aee8d83): telas e fluxos do `app/` (participante, palestrante e equipe)
- Guia para a comunidade anfitriã: criar a edição, conectar o gateway, tematizar e abrir o CFP (a escrever)


Expand Down
52 changes: 52 additions & 0 deletions app/.claude/rules/architecture.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
# Architecture

Clean Architecture, four layers per feature, plus a shared `core/`.

## Dependency Rule

```
presentation --> domain <-- data <-- infrastructure
```

- `domain/` depends on nothing else in the app (no Flutter, no `dio`, no other layer). It is pure Dart.
- `data/` depends only on `domain/` (implements its repository interfaces, extends its entities into models).
- `presentation/` depends only on `domain/` (calls usecases, never talks to a datasource or repository implementation directly).
- `infrastructure/` may depend on `domain/` and `data/` (interceptors, feature-scoped services).

If a file in `domain/` needs to import something from `data/`, `presentation/`, `material_ui/material_ui.dart`, or a package like `dio`, that's a violation - move the logic to the layer that's allowed to depend on it, or invert the dependency behind an interface in `domain/`.

## Layer responsibilities

**Domain** (`domain/`)
- `entities/`: immutable business objects (`final` fields, `const` constructor, extend `Equatable`).
- `dtos/`: mutable input parameters for usecases (e.g. `LoginParams` - plain fields + `set{Field}()` methods, not `copyWith`), with a static `empty()` factory and `toJson()`.
- `repositories/`: abstract interfaces only (`abstract interface class I{Feature}Repository`), methods return `AsyncResult<T>`.
- `usecases/`: one class per action, implements `UseCase<Output, Input>` (`lib/src/core/interfaces/usecase_interface.dart`), holds business rules that don't belong in the BLoC or the repository.
- `validators/`: `LucidValidator<Params>` subclasses, one rule per field.

**Data** (`data/`)
- `models/`: extend the matching entity, add `fromMap`/`toMap`/`fromJson`/`toJson`. This is the only place JSON parsing happens.
- `datasources/`: talk to `IRestClient` (or local storage) and return raw responses. No business logic, no error mapping.
- `repositories/`: implement the domain interface, catch `RestClientException`/other exceptions, map them to `BaseException` subclasses, return `Success`/`Failure`.

**Presentation** (`presentation/`)
- `bloc/`: one bloc per feature; events and states are `part of` the bloc file, both extend `Equatable`.
- `pages/`: `BlocListener` for side effects (snackbars, navigation), `BlocBuilder` for rebuilding UI - keep them separate, don't mix into one `BlocConsumer` unless the widget genuinely needs both in the same spot.
- `widgets/`: reusable UI pulled out of pages once it's used more than once.

**Infrastructure** (`infrastructure/`)
- Interceptors and services that are specific to one feature (e.g. `auth_interceptor.dart` attaching the session token). Cross-feature infrastructure belongs in `core/`.

## Core (`lib/src/core/`)

Shared, feature-agnostic code: `DI/` (get_it setup), `cache/`, `client_http/` (Dio wrapper + interceptors), `errors/` (`BaseException` hierarchy), `extensions/`, `interfaces/` (`UseCase`), `services/` (e.g. `SessionService`), `utils/`.

Never import a feature from `core/`. If `core/` needs feature-specific behavior, that's a sign the code belongs in the feature's `infrastructure/` instead.

## Data flow

```
UI -> BLoC -> UseCase -> Repository (interface) -> Repository (impl) -> DataSource -> API / local storage
```

Errors flow back up the same chain as `Failure(BaseException)`, never as a thrown exception crossing a layer boundary.
38 changes: 38 additions & 0 deletions app/.claude/rules/naming-conventions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Naming Conventions

Match these exactly - they're taken from the `auth` feature, which is the reference implementation for everything else in this template.

| Kind | File name | Class name | Example |
|---|---|---|---|
| Entity | `{entity}_entity.dart` | `{Entity}Entity` | `user_entity.dart` -> `UserEntity` |
| DTO / params | `{action}_params.dart` | `{Action}Params` | `login_params.dart` -> `LoginParams` |
| Repository interface | `{feature}_repository_interface.dart` | `I{Feature}Repository` | `auth_repository_interface.dart` -> `IAuthRepository` |
| Repository impl | `{feature}_repository_impl.dart` | `{Feature}RepositoryImpl` | `auth_repository_impl.dart` -> `AuthRepositoryImpl` |
| Usecase | `{action}_usecase.dart` | `{Action}Usecase` | `login_usecase.dart` -> `LoginUsecase` |
| Validator | `{params}_validators.dart` | `{Params}Validators` | `login_params_validators.dart` -> `LoginParamsValidators` |
| Model | `{entity}_model.dart` | `{Entity}Model` (extends `{Entity}Entity`) | `user_model.dart` -> `UserModel` |
| Remote datasource | `{feature}_remote_datasource.dart` | `{Feature}RemoteDatasource` | `auth_remote_datasource.dart` -> `AuthRemoteDatasource` |
| Local datasource | `{feature}_local_datasource.dart` | `{Feature}LocalDatasource` | |
| Bloc | `{feature}_bloc.dart` | `{Feature}Bloc` | `auth_bloc.dart` -> `AuthBloc` |
| Bloc events | `{feature}_event.dart` (`part of`) | `{Feature}{Action}Requested` | `AuthLoginRequested` |
| Bloc states | `{feature}_state.dart` (`part of`) | `{Feature}{Status}` | `AuthLoading`, `AuthLoginSuccess`, `AuthFailure` |
| Page | `{page}_page.dart` | `{Page}Page` | `login_page.dart` -> `LoginPage` |
| Widget | `{component}_widget.dart` | `{Component}Widget` | |

## Class modifiers

- Everything is a plain `class` (entities, DTOs, models, repository impls, usecases, blocs, events, states) - this codebase does not use `final class`, even for types nothing currently extends.
- Repository interfaces are the one exception: `abstract interface class I{Feature}Repository`.
- Events/states base classes are `abstract class` (`AuthEvent`, `AuthState`); concrete subclasses are plain `class`.
- Prefer `const` constructors wherever the fields allow it, but don't force it where the existing feature doesn't (e.g. `LoginUsecase`'s constructor isn't `const`).

## Tests

Mirror the `lib/` path under `test/unit/` or `test/widget/`:

```
lib/src/app/features/auth/domain/usecases/login_usecase.dart
test/unit/auth/domain/usecases/login_usecase_test.dart
```

Mock classes: `Mock{ClassName}` using `mocktail` (`class MockAuthRepository extends Mock implements IAuthRepository {}`). BLoC tests use `bloc_test`'s `blocTest`.
18 changes: 18 additions & 0 deletions app/.claude/rules/solid-principles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# SOLID in This Codebase

Concrete, not theoretical - how each principle actually shows up here.

**Single Responsibility**
A datasource only makes HTTP calls; it doesn't parse business rules. A validator only validates. A usecase only orchestrates one action. If a class's steps have more than one reason to change independently, split it.

**Open/Closed**
New behavior is added by creating a new usecase/repository/bloc, not by piling `if`/`switch` branches for a new scenario into an existing one (see `AuthRepositoryImpl.login`'s status-code mapping for the shape to extend, not the shape to keep growing indefinitely).

**Liskov Substitution**
`{Entity}Model` extends `{Entity}Entity` and must be usable everywhere the entity is expected - no overridden field changes behavior in a way that breaks callers holding an `{Entity}Entity` reference. Any `I{Feature}Repository` implementation must satisfy the same contract (return `Success`/`Failure`, never throw) as every other implementation of that interface.

**Interface Segregation**
Repository interfaces are scoped per feature (`IAuthRepository`, not one giant `IRepository`). Don't add a method to an interface for a caller that could instead depend on a narrower interface.

**Dependency Inversion**
`presentation/` and `data/` depend on the abstract `I{Feature}Repository`, never on `{Feature}RepositoryImpl` directly. Wiring the concrete implementation to the interface happens in one place: `lib/src/core/DI/dependency_injector.dart` (get_it). This is also why `domain/` can have zero external dependencies - everything it needs from outer layers is expressed as an interface it defines and an outer layer implements.
Loading
Loading