Skip to content
Closed
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
28 changes: 28 additions & 0 deletions docs/getting_started/PROJECT_STRUCTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,31 @@ infra/
tests/ Infra tests
nix/ Shared Nix configs
```

When making a new endpoint, you'll need to add files in the following locations:

1. **API Definition**: `fern/definition/<my-pkg>/<endpoint>/__package.yml`: This is where the API definition goes.

1. **API Router**: `svc/api/<my-pkg>/src/route/mod.rs`: This might call an `op!` or a `msg!` from the business logic.

1. **API Endpoint**: `svc/pkg/<my-pkg>/src/route/<endpoint>.rs`: The handler for the route goes here.

1. **Business Logic**: `svc/pkg/<my-pkg>`: This is where the actual business logic goes.

```mermaid
sequenceDiagram
participant Client as Client
participant API_Router as API Router (svc/api/<my-pkg>/src/route/mod.rs)
participant API_Endpoint as API Endpoint (svc/pkg/<my-pkg>/src/route/<endpoint>.rs)
participant Business_Logic as Business Logic (svc/pkg/<my-pkg>)

Client->>API_Router: Request
API_Router->>API_Endpoint: Forward request
API_Endpoint->>Business_Logic: Call business logic
Business_Logic-->>API_Endpoint: Return result
API_Endpoint-->>API_Router: Return result
API_Router-->>Client: Response
```

Notes:
- When working on endpoints, you need to include crates for adding ops, messages, and other dependencies.