Skip to content

Architecture · By Rivtor · Updated

Where should your frontend, API and database run?

Choose service placement around the request path. Browser requests need public endpoints; backend-to-database operations benefit from appropriate private networking and a suitable data region.

See the Rivtor deployment workflow →

Draw the complete request path

Start with the browser loading a page, then requesting API data and the backend querying Postgres. Globally cached static assets do not move a dynamic backend closer to every user. Separate asset delivery from dynamic response latency when evaluating hosting regions.

Keep credentials behind the API

A frontend can know the API address without knowing database credentials. Enforce authentication and record ownership in server code. Private networking and database permissions complement application authorization rather than replacing it.

Define failure boundaries

Separately deployable services allow targeted changes but introduce contracts that must remain compatible. Decide which process runs migrations, which service owns each table and how API changes are rolled out. Fewer dashboards do not remove those design choices.

Evaluate with your actual stack

Test an end-to-end write, inspect logs and understand rollback behavior. Rivtor detects supported services and can wire their URLs together. Its framework reference documents overrides when an application needs explicit configuration. Validate that the generated plan matches the repository you actually intend to host.

Follow a request across the trust boundaries

Browser -> public frontend
Browser -> public API -> private database connection
Server-rendered frontend -> API or server-side database access
Worker -> queue and database

A browser cannot safely carry a database password. A server-rendered page can perform server-side work, but a public configuration variable still belongs to the browser bundle. Decide which component is responsible for authorization and validate it independently from network reachability.

Co-location is one part of a decision

Putting an API close to its database can reduce one network hop. Overall response time also includes the user's route to the region, application computation, queries and rendering. Static assets served from an edge network do not move a dynamic database-backed request into that same edge location.

Record where users are located and which requests dominate the application. Compare real browser/API journeys from those locations instead of projecting one local latency measurement worldwide.

Choose boundaries that match the workload

A single framework application may handle both pages and API routes. A separate Python API is useful when its runtime or dependencies fit the service. A worker needs its own process when jobs should continue independently of incoming requests.

Start with the Next.js/FastAPI/Postgres example, then account for workers and costs. Consult Rivtor data documentation for the supported service connections.

Next steps

Read the Rivtor reference for supported configuration and limitations, and use the deployment quickstart when trying Rivtor for the first time. Validate workflows with synthetic data before connecting valuable production records.