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
6 changes: 3 additions & 3 deletions .cursor/rules/00-modulith-architecture.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ Maintain this repo as a **base template** for a **Modular Monolith (Modulith)**

## When adding a new module

- Use `make new-module <name>`.
- Use `just new-module <name>`.
- Then:
- `make generate-all` (generates sqlc + proto + mocks)
- `just generate-all` (generates sqlc + proto + mocks)
- Register the module in `cmd/server/main.go` (and in its `<mod>-svc` if applicable).
- Run migrations: `make migrate-up`
- Run migrations: `just migrate-up`
68 changes: 34 additions & 34 deletions .cursor/rules/05-development-workflow.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -9,81 +9,81 @@ This project uses `make` commands for all development tasks. Always prefer `make

## Quick Reference

- **Setup**: `make quickstart` (first time) or `make validate-setup`
- **Code Generation**: `make generate-all` (runs sqlc + proto + mocks)
- **Development**: `make dev` (server) or `make dev-worker` (background tasks)
- **Testing**: `make test-unit` (fast) or `make test-all` (complete)
- **Quality**: `make format`, `make lint`, `make pre-commit`
- **Setup**: `just quickstart` (first time) or `just validate-setup`
- **Code Generation**: `just generate-all` (runs sqlc + proto + mocks)
- **Development**: `just dev` (server) or `just dev-worker` (background tasks)
- **Testing**: `just test-unit` (fast) or `just test-all` (complete)
- **Quality**: `just format`, `just lint`, `just pre-commit`

### Code Generation

- **ALWAYS run `make generate-all`** after modifying:
- **ALWAYS run `just generate-all`** after modifying:
- SQL queries (`.sql` files) → runs `sqlc`
- Protobuf definitions (`.proto` files) → runs `proto`
- Interface changes (for mocks) → runs `generate-mocks`
- Individual commands also available: `make sqlc`, `make proto`, `make generate-mocks`
- Individual commands also available: `just sqlc`, `just proto`, `just generate-mocks`

### Code Quality

- **Before committing**: Run `make pre-commit` (format + lint + test-unit)
- **Format code**: Use `make format` (uses gofmt + goimports if available)
- **Lint code**: Use `make lint` (strict linter, 0 issues required)
- **Tidy dependencies**: Use `make tidy` (runs `go mod tidy`)
- **Before committing**: Run `just pre-commit` (format + lint + test-unit)
- **Format code**: Use `just format` (uses gofmt + goimports if available)
- **Lint code**: Use `just lint` (strict linter, 0 issues required)
- **Tidy dependencies**: Use `just tidy` (runs `go mod tidy`)

### Testing

- **Unit tests**: `make test-unit` (fast, generates mocks automatically)
- **Integration tests**: `make test-integration` (requires Docker)
- **All tests**: `make test-all` (unit + integration)
- **Coverage**: `make coverage-report` or `make coverage-html`
- **Unit tests**: `just test-unit` (fast, generates mocks automatically)
- **Integration tests**: `just test-integration` (requires Docker)
- **All tests**: `just test-all` (unit + integration)
- **Coverage**: `just coverage-report` or `just coverage-html`

### Development Server

- **Main server**: `make dev` (hot reload with Air)
- **Worker**: `make dev-worker` (background tasks)
- **Module**: `make dev-module MODULE_NAME=<name>` (single module)
- **No reload**: `make run` (uses `go run` directly)
- **Main server**: `just dev` (hot reload with Air)
- **Worker**: `just dev-worker` (background tasks)
- **Module**: `just dev-module MODULE_NAME=<name>` (single module)
- **No reload**: `just run` (uses `go run` directly)

### Database & Migrations

- **Run migrations**: `make migrate-up` or `make migrate`
- **Create migration**: `make migrate-create MODULE=<name> NAME=<migration_name>`
- **Rollback**: `make migrate-down MODULE=<name>`
- **Reset database**: `make db-reset` (destructive, drops all tables)
- **Seed data**: `make seed`
- **Run migrations**: `just migrate-up` or `just migrate`
- **Create migration**: `just migrate-create MODULE=<name> NAME=<migration_name>`
- **Rollback**: `just migrate-down MODULE=<name>`
- **Reset database**: `just db-reset` (destructive, drops all tables)
- **Seed data**: `just seed`

### Common Workflows

**First-time setup:**

```bash
make quickstart
just quickstart
```

**Daily development:**

```bash
make docker-up-minimal # Start DB + Redis
make migrate-up # Run migrations if needed
make dev # Start dev server
just docker-up-minimal # Start DB + Redis
just migrate-up # Run migrations if needed
just dev # Start dev server
```

**Before committing:**

```bash
make generate-all # Generate code if needed
make pre-commit # Format + lint + test
just generate-all # Generate code if needed
just pre-commit # Format + lint + test
```

**Adding a new module:**

```bash
make new-module <name>
make generate-all # After adding SQL/proto
make migrate-up
just new-module <name>
just generate-all # After adding SQL/proto
just migrate-up
```

### Help

- **List all commands**: `make help`
- **List all commands**: `just help`
- **Full reference**: See `docs/MAKE_COMMANDS_REFERENCE.md`
14 changes: 7 additions & 7 deletions .cursor/rules/10-go-quality.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ alwaysApply: false

## Code Quality Workflow

- **Before committing**: Run `make pre-commit` (format + lint + test-unit)
- **Format code**: Use `make format` to format code with gofmt/goimports
- **Lint code**: Use `make lint` after any modification that includes `.go` files
- **Before committing**: Run `just pre-commit` (format + lint + test-unit)
- **Format code**: Use `just format` to format code with gofmt/goimports
- **Lint code**: Use `just lint` after any modification that includes `.go` files
- **Iterate on fixes** until **all linting issues are resolved** (0 issues).
- **NEVER modify `.golangci.yaml`** to ignore or suppress lint errors.
- Always implement **proper fixes** for lint issues:
Expand All @@ -35,12 +35,12 @@ alwaysApply: false

## Testing Workflow

- **ALWAYS run `make test-unit`** after adding or modifying tests (faster, generates mocks).
- Use `make test-all` for complete testing (unit + integration).
- **ALWAYS run `just test-unit`** after adding or modifying tests (faster, generates mocks).
- Use `just test-all` for complete testing (unit + integration).
- Ensure all tests pass before considering the work complete.
- Write clear, focused test cases with descriptive names.

## Code Generation Workflow

- **After modifying SQL/proto/interfaces**: Run `make generate-all` (runs sqlc + proto + mocks)
- Individual commands available: `make sqlc`, `make proto`, `make generate-mocks`
- **After modifying SQL/proto/interfaces**: Run `just generate-all` (runs sqlc + proto + mocks)
- Individual commands available: `just sqlc`, `just proto`, `just generate-mocks`
2 changes: 1 addition & 1 deletion .cursor/rules/25-protobuf-validation.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ The module scaffolding template (`templates/module/proto/module.proto.tmpl`) alr
- Validation import
- Example validation annotations on request messages

New modules created with `make new-module` will have validation examples by default.
New modules created with `just new-module` will have validation examples by default.

### Examples

Expand Down
2 changes: 1 addition & 1 deletion .cursor/rules/30-data-sqlc.mdc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ alwaysApply: false
func GetMagicCode(ctx context.Context, code string) (*store.MagicCode, error)
```

- After running `make sqlc`, check `modules/<mod>/internal/db/store/models.go` to see the exact generated type names.
- After running `just sqlc`, check `modules/<mod>/internal/db/store/models.go` to see the exact generated type names.

## Repository pattern

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:

- name: Build binaries
run: |
make build-all
just build-all

- name: Create changelog
id: changelog
Expand Down
14 changes: 7 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,18 @@ Thank you for your interest in contributing! This document provides guidelines f

3. **Install dependencies**:
```bash
make install-deps
just install-deps
```

4. **Start infrastructure**:
```bash
make docker-up
just docker-up
```

5. **Run tests**:
```bash
make test
make lint
just test
just lint
```

## 📋 Contribution Process
Expand All @@ -50,13 +50,13 @@ Ensure you follow the project conventions:

```bash
# Linter (must pass with 0 errors)
make lint
just lint

# Tests
make test
just test

# Coverage (optional but recommended)
make coverage-report
just coverage-report
```

### 4. Commit and Push
Expand Down
Loading
Loading