Vinova Lab · Engineering

Rainty module challenge

The common brief that opens every module challenge.

This text opens every Rainty module challenge. The section that follows it, written for each challenge, says which module: its data, its screens, its events, and any acceptance criteria of its own.

What we are building

Rainty is Vinova Lab’s application for professionals who manage a book of customers: personal trainers, teachers, health and beauty professionals, insurance agents, real-estate agents. It is one application. What changes from one customer to the next is the set of modules they have: an agenda, invoicing, photos, case files, measurements, and more.

A module is a feature that can be switched on or off per organisation and per user. The switch is the licence: a plan, or an override set from our admin console or through the licence API. When a module is on, its menu entry, pages and customer-record tab are there; when it is off, nothing of it is visible and its API answers 403 MODULO_NON_ATTIVO. The application behaves identically in both cases, and the module itself never decides whether it is active.

Modules are being built in parallel by several people, one module per challenge. They do not depend on each other. What they share is the core, which is ours and already runs in the development environment: the customers, the customer record, the timeline of what happened to a customer, and the activation check.

What a module is

A module is one folder in the rainty repository, frontend/modules/<key>/, plus one line that registers it in frontend/modules/index.ts. The folder contains:

  • manifest.ts — what the shell needs to know: key, contract version, routes, menu entry, customer-record tab, the events the module emits, the translation loaders.
  • pages/, components/, hooks/ — the user interface, built with the design system.
  • api/ — one function per API route, built on @rainty/api.
  • i18n/it.json, i18n/en.json — every text the user reads, in both languages.
  • tests.
  • PROPOSTA.md — the proposal of the backend the module needs (below).

The backend is ours. You do not write tables or API routes: you propose them in PROPOSTA.md, we review the proposal, put tables and routes in place in the development environment within the next working day, and you build against them. If you need a datum the core does not have, you ask for it the same way. While you wait, you work with fake data that matches the proposal.

Three documents say how all of this is done, and the work is reviewed against them:

What the core gives you

The core is already running in the development environment. You use it only through its API, with @rainty/api; you never read its tables.

Customers — /rainty/clienti:

  • GET /rainty/clienti?q=&stato=&limit=&offset= — search by name, company name, e-mail or phone; returns { clienti, totale }.
  • POST /rainty/clienti — create.
  • GET /rainty/clienti/:id — read.
  • PATCH /rainty/clienti/:id — update.
  • GET /rainty/clienti/:id/timeline?prima=&moduli=&limit= — the customer’s timeline, newest first, with a cursor.

A customer has id, tipo (persona or azienda), nome, cognome, ragioneSociale, email[], telefoni[], lingua, note, stato, responsabileId. The organisation is always the one of the signed-in user; you never pass it. In your tables you keep only cliente_id, never a copy of the customer.

Customer record — your manifest registers a tab with schedaCliente: [{ id, titolo, componente }]; the component receives clienteId and loads its own data. TimelineCliente from @rainty/nucleo shows a customer’s timeline inside your pages if you need it.

Current customer — in the application the user may have selected a customer, or not. If your module has a page of its own that spans customers (a list, a board, a calendar), it works in both cases. Read the current customer with useClienteCorrente() from @rainty/nucleo: it returns the customer id as a string (like the clienteId prop of the tab), or null when none is selected.

  • With a customer: show only that customer’s data, and use it as the default wherever the module would ask for one.
  • Without a customer: show the cross-customer view the module needs, and ask for the customer only when an action requires one, with the customer picker of the core.
  • Never build a customer selector of your own for the page, and never store the selection yourself.

Until the selector exists in the shell, the hook reads ?cliente=<id> from the page address, before the # (for example /?cliente=12#/your-page); that is how you try both cases by hand. Do not put the parameter inside the # part: the router would read it as part of the page name.

Timeline — you do not write events from the frontend. The routes we build from your proposal write them, in the same operation that creates the object, with the event types you declare in the manifest. Only a service of your own, if the module has one, writes events directly, through an internal route with a token we give it.

Tables and routes — you do not create them. PROPOSTA.md lists the tables of schema rainty_<key> (one table per section: column, type, notes), the routes /rainty/<key>/… (method, path, input, output), the events, and what you use from the core. We write the migrations and the routes, apply them in the development environment and answer in the pull request within the next working day. A change later is a new migration, never an edit of the applied one; update PROPOSTA.md and ask in the pull request.

Not there today, and not to be built or waited for: activities and reminders, custom fields, the event stream between modules, the agent tools, the home widgets. If your module needs a customer field that does not exist, ask for it in the proposal: we add it to the core, and you do not wait.

How the work goes

  1. Read the three documents and the module section of this challenge.
  2. Propose. Write PROPOSTA.md in your module folder and open the pull request with it, even if nothing else is there. The proposal is one page: the tables, the routes, the events, what the module uses from the core.
  3. Build while we put the backend in place: manifest, pages, components, API client, texts, tests. Your development user has the module switched on; nobody else sees it.
  4. Adjust. A column more, a route more: update PROPOSTA.md and ask in the pull request. It is normal, and it is why the proposal is kept small.
  5. Deliver. The pull request is complete, the checks are green, the module works in the development environment. We review, merge and deploy.

Where you work

On the Dev Platform, in the workspace we give you: VS Code in the browser, the rainty repository mounted, your GitHub login, Claude Code available. It is also where we look at your work while it is in progress and where acceptance is run, so work there and not on a copy elsewhere.

  • Your branch is feature/<key>. You push only that branch. The pull request against main is yours to open; the merge is ours.

  • You try the frontend in your workspace preview, which talks to the development environment. In your workspace console, open Repositories and rebuild rainty / rainty-frontend from your branch, then open https://preview-<login>.vinovalab.ai. Rebuild again to see new changes.

    The preview sends sign-in and the API calls (/auth, /data-service, /docs-service, /banking-service) to the development environment. A dev server opened on localhost cannot sign in there: the development environment accepts only its own hosts and the previews.

  • Sign in with your development user: the same email as your invitation. The first time, set its password with “Forgot password” on https://dev.rainty.vinovalab.ai.

  • You do not build, deploy, migrate or restart anything shared. Your branch and your workspace are the whole of your footprint.

Rules that are not negotiable

  • Nothing outside your folder, except your line in frontend/modules/index.ts. No shell file, no shared component, no other module.
  • Imports: only react, react-i18next, @vinovalab/app-shell, @rainty/ui, @rainty/api, @rainty/nucleo, @rainty/i18n and vitest. Never UserInterface/, never another module’s folder. npm run check:moduli -- --strict is the judge.
  • Every text goes through t(), with the same keys in it and en. Dates and numbers through localeOf.
  • The design system, light and dark mode, phones first. Components from @rainty/ui; nothing page-local that already exists.
  • No activation logic of your own. The shell and our routes do it.
  • No secrets, no tracked .env, no host but ours.

What you hand over

A pull request on rainty from feature/<key> containing your module folder: PROPOSTA.md kept up to date, the manifest, the pages, the API client, the texts in both languages, the tests, and a short README.md with what surprised you: where the documents did not match what you found, and what you did about it.

How it gets accepted

  1. The checks are green on your branch: tsc --noEmit with zero errors, npm test (the conformance test on the real manifests included), npm run check:moduli -- --strict, check:architecture, check:i18n-strings, check:locales. Nothing else is looked at until this holds.
  2. It switches. With the override on, the module is in the menu, its pages work against the development environment, its tab is in the customer record. With the override off, all of it is gone and its routes answer 403. We flip the override ourselves.
  3. Every action that matters to a customer is on the timeline, with the events declared in the manifest, readable in the customer record. If the module has a page spanning customers, it also works with the current customer: opened with ?cliente=<id> it shows only that customer’s data and does not ask for the customer again; opened without it, it shows the cross-customer view; the module has no customer selector of its own.
  4. The proposal matches the code. PROPOSTA.md describes what the module actually uses.
  5. It works for a real user. We sign in to the Rainty console in the development environment with your user and use it, on a desktop and on a phone-sized window, in light and dark mode. If something fails there while your tests are green, we work it out together and it is not held against you.
  6. The module section of this challenge may add criteria of its own.

When the documents are wrong

The contract and the anatomy were written before the first module. Where they do not match what you find in the repository, say so on the challenge before working around it. Fixing the documents is our job, not yours; the window pauses while you wait for an answer, and we answer proposals and changes within the next working day.