Startpunt voor een Astro-website die bij BB Open gehost wordt
  • Astro 54%
  • CSS 35.9%
  • JavaScript 10.1%
Find a file
Bram Buijs 4d6e27fe57 docs: JavaScript, eigen framework en Odoo-koppeling beschreven
De README zei dat een push vanzelf live komt; dat klopt niet, het image wordt
vanzelf gebouwd maar live zetten is een stap bij BB Open. Nu staat er dat de
klant dat met BB Open afspreekt.

Nieuw: statisch betekent niet zonder JavaScript (eigen bestanden, eigen
domein, zoals de CSP eist), een ander framework mag als het met npm naar
dist/ bouwt zonder inline scripts, en een koppeling met de Odoo-API die een
sleutel vraagt zetten we samen op, omdat een statische site geen sleutel
geheim kan houden.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-09-29 11:37:00 +02:00
public Startpunt voor een Astro-website bij BB Open 2026-09-17 15:17:17 +02:00
src docs: starter volledig in het Engels 2026-09-29 11:29:02 +02:00
.gitignore Startpunt voor een Astro-website bij BB Open 2026-09-17 15:17:17 +02:00
.gitlab-ci.yml docs: starter volledig in het Engels 2026-09-29 11:29:02 +02:00
.mcp.json Startpunt voor een Astro-website bij BB Open 2026-09-17 15:17:17 +02:00
.nvmrc Startpunt voor een Astro-website bij BB Open 2026-09-17 15:17:17 +02:00
astro.config.mjs docs: starter volledig in het Engels 2026-09-29 11:29:02 +02:00
CLAUDE.md docs: JavaScript, eigen framework en Odoo-koppeling beschreven 2026-09-29 11:37:00 +02:00
package-lock.json Startpunt voor een Astro-website bij BB Open 2026-09-17 15:17:17 +02:00
package.json Startpunt voor een Astro-website bij BB Open 2026-09-17 15:17:17 +02:00
README.md docs: JavaScript, eigen framework en Odoo-koppeling beschreven 2026-09-29 11:37:00 +02:00
tsconfig.json Startpunt voor een Astro-website bij BB Open 2026-09-17 15:17:17 +02:00

Astro starter

Starting point for a website hosted by BB Open, built with Astro. Copy this repository into the repository where your site will live: the one BB Open provides for you, or your own GitLab, GitHub or Forgejo. BB Open fetches it from there, builds it and publishes it on your domain.

Taking it over

git clone https://git.edano.eu/bb-open/astro-starter.git my-website
cd my-website
rm -rf .git && git init -b main
git add -A && git commit -m "Website starting point"
git remote add origin <the URL of your own repository>
git push -u origin main

Then adjust: the name in src/layouts/Base.astro (SITE_NAME), the domain in astro.config.mjs (site), and the texts in src/pages/.

Working locally

nvm use            # Node 22, see .nvmrc
npm install
npm run dev        # http://localhost:4321

Before you push:

npm run check      # type errors
npm run build      # builds to dist/, the way BB Open does

On GitLab, the pipeline (.gitlab-ci.yml) runs the same steps on every push. If it is red, the site will not build at BB Open either, and the previous version stays live. Elsewhere, run the two commands above yourself.

From push to live

Push to the live branch (main). BB Open picks up the change within about fifteen minutes and builds a new version of the site. Agree with BB Open how that version goes live; ask if you are not sure what applies to your site.

What you can build

Static does not mean without JavaScript. Interactive components, sending a form without reloading the page, islands with React, Vue or Svelte through the Astro integrations: it all works. Two conditions, both from the Content-Security-Policy:

  • Scripts live in their own files, which Astro does by default. No inline <script>.
  • Requests from the browser go to your own domain. A fetch to another domain is blocked unless BB Open has allowed that domain.

Another framework is fine too. Astro is a suggestion, not a requirement. Any framework works as long as:

  • it uses npm, with package-lock.json in the repository;
  • npm run build produces a static site in dist/, with dist/index.html;
  • it builds on Node 22 and needs no server at runtime;
  • it does not inject inline scripts or styles. Several frameworks do that by default (Next.js, for example); the page then breaks under the CSP.

If you switch, keep CLAUDE.md and this README in line with what you use.

Connecting to Odoo

Your site can do more with your Odoo than the contact form. Other Odoo forms, such as job applications or a newsletter sign-up, work the same way: through BB Open's web server, on your own domain, without a key. Ask us to switch on the ones you need.

For anything that needs the Odoo API, such as showing products, events or vacancies, or creating records, keep in mind that a static site cannot keep a key secret: everything that reaches the browser is visible to every visitor. So we set up such a connection together, for example as a route on BB Open's web server that talks to Odoo on your behalf, or as data fetched when the site is built. Tell us what you want to connect; we are happy to help.

The rules

These are the agreements that make the site build and run safely at BB Open.

  1. It stays a static site. No server adapter (@astrojs/node and the like) and no output: 'server': BB Open runs only a web server, no Node.
  2. npm, with a package-lock.json in the repository. Commit the lockfile; the build uses npm ci.
  3. No secrets in the repository or in the build. No API keys, no committed .env.
  4. No inline style or script. The web server sends a strict Content-Security-Policy. astro.config.mjs is already set up for that; leave those two settings in place, and do not use style="..." attributes or <script is:inline>.
  5. Report external sources first. Fonts, analytics, video embeds or maps from another domain are blocked by default. Tell BB Open which domains you need and they will be allowed. Self-hosting (a font in public/fonts/) always works and is faster.

The contact form

src/pages/contact.astro posts to /formulier/lead. BB Open's web server forwards that to Odoo, where the submission becomes a lead in CRM. There is no API key in the site.

  • The field names (contact_name, email_from, phone, partner_name, name, description) are Odoo's. Do not rename them. If you want extra fields, check with BB Open: they have to be allowed in Odoo.
  • The hidden field website_url is a spam trap. Leave it in.
  • The path /formulier/lead is agreed with the web server; keep it.
  • Locally (npm run dev) submitting does not work: the path only exists on the live server. You can test the layout and the validation locally.
  • BB Open switches on the forwarding once the Website and CRM apps are active in Odoo. Until then, submitting gives an error.

Working with Claude

This repository is set up for Claude Code:

  • CLAUDE.md contains the rules above, so Claude follows them without you having to repeat them every time.

  • .mcp.json connects the official Astro Docs MCP server (https://mcp.docs.astro.build/mcp), so Claude consults the current Astro documentation instead of guessing. Claude Code asks on first start whether you want to allow this server. You can also add it by hand:

    claude mcp add --transport http astro-docs https://mcp.docs.astro.build/mcp
    

Structure

src/pages/       one file per page; the file name is the URL
src/layouts/     the shared layout (header, menu, footer)
src/styles/      the stylesheet
public/          files copied as-is (images, robots.txt)

Questions: support@bb-open.com