Build for the company you want to become: architecture for a million rows
The stack behind RemoteMaroc, the reason for each piece, and four architecture rules worth keeping on any product.
By Hassan Ed-dyb · · 2 min read
Short answer: design for the scale you are aiming at, not the scale you have. RemoteMaroc was built for a million rows from day one: server-rendered Next.js, Postgres doing the heavy lifting, pages cached at the edge, a backup for every AI provider, and every list tested against a million-row database. Four rules carry over to any product.
The stack, and why
- —App: Next.js and TypeScript, rendered on the server, one design system, English, French and Spanish from the first line. Adding languages later is a rewrite; adding them first is a habit.
- —Data: Postgres does search, ranking and row-level security on every table. Jobs arrive from 200+ sources and refresh every 2 hours.
- —Edge: public pages are cached in the data center nearest each visitor.
- —AI: every call has a second provider. If moderation or translation is down, the backup answers. If both are, nothing breaks.
- —Scale: every search, filter and list is tested against one million rows. Every list is paginated, every filter indexed.
Four rules I'd keep on any product
1. Fewer moving parts
Every service you add is something that can fail, drift or need an upgrade. If the database can do search well, don't add a search engine yet. Simple systems scale further than people expect.
2. Security lives in the database, not the form
A check in the interface protects one screen. A rule in the database protects every screen, every API and every future feature. Row-level security that denies by default means a forgotten check can't leak data.
3. A second provider, not a second key
A spare API key from the same provider fails at the same moment the first one does. Real resilience is a different provider behind the same interface.
4. Translate on save, never on view
Translating text every time someone reads it multiplies cost and latency by your traffic. Translate once when it is written, store every language, and serve it like any other data.
Build for the company you want to become, not the one you are today.