# Lovable

Lovable builds the frontend with Vite and puts the backend in its built-in Cloud on Supabase. That gives one rule: the AstroWay key lives in **Secrets** and is read by an Edge Function, and the browser calls the function. A `VITE_*` variable will not do even for a moment: Vite bakes it into the bundle every visitor downloads.

## 1. The key

Create a **Server only** key scoped to `chart` with a budget, as described in [A key for an automation](/en/integrations/#a-key-for-an-automation). The budget matters here: anyone who opens your published app can call the function.

## 2. The prompt

Paste into the project chat:

```text title="prompt"
Add an Edge Function named big-three. It reads the secret ASTROWAY_API_KEY
(ask me for it with the secure secret form) and POSTs the JSON body
{ date, time, timezone, latitude, longitude } to
https://api.astroway.info/v1/chart with the header "X-Api-Key: <secret>".
Never put the key in client code or in a VITE_ variable.

The response is { ok: true, data: {...} } or { ok: false, error: { code,
message } }. On error return the error object with the same HTTP status.
On success return { sun, moon, rising, offset_used } where each sign is
SIGNS[Math.floor(longitude / 30)] with SIGNS = Aries, Taurus, Gemini,
Cancer, Leo, Virgo, Libra, Scorpio, Sagittarius, Capricorn, Aquarius,
Pisces; sun and moon come from data.planets entries named "Sun" and
"Moon", rising from data.houses.ascendant, offset_used from
data.input.timezoneOffset.

Then add a form with date, time, an IANA time zone (default Europe/Kyiv),
latitude and longitude, and show the three signs from the function.
```

Lovable asks for the `ASTROWAY_API_KEY` value in a secure form in the chat. You can replace the secret later under **More → Settings → Secrets**: values there are write-only and cannot be viewed again.

The function Lovable should end up with is in essence the one on [Supabase Edge Function](/en/integrations/supabase/). If the generated code differs, paste that file and ask Lovable to use it.

## 3. Check it

Enter `1990-05-15`, `14:30:00`, `Europe/Kyiv`, `50.45`, `30.52`. The right answer: Sun `Taurus`, Moon `Capricorn`, rising `Virgo`, offset `4`. An offset of 3 means the app works out the offset itself instead of sending the zone name, and every house is shifted. One calculation costs 20 credits.

## Our docs in the Lovable chat

So that Lovable takes field and endpoint names from our documentation rather than guessing, connect the docs server as a chat connector. It needs no key and spends no credits.

1. **Connectors → Add custom → MCP server**.
2. **Server name** `AstroWay docs`, **Server URL** `https://mcp.astroway.info/mcp/docs`.
3. **Authentication**: No authentication.

You can then write in the chat, for example, "Using AstroWay docs, find the endpoint for a daily horoscope by sign and add it". A chat connector works only while you build and never reaches the published app, so calculations in the app still go through the Edge Function.

**Note:**
Checked on 2026-11-07: the Edge Function from [Supabase](/en/integrations/supabase/) ran locally in Deno against AstroWay production and gave the answer above; the docs server answered `tools/list` and `find_endpoint` with no key. The steps in the Lovable interface follow its documentation and were not carried out in this check.
