Build your own Metabase in Java with AI and AppJars
A Metabase-style BI tool in Java, built by an AI coding agent from five short specs on top of AppJars: saved questions, a dashboard and a weekly report by email. Open source.

The feature people love most in a BI tool is not a chart. It is the email that shows up every Monday at eight with last week’s numbers, without anybody having to open anything.
So that was the goal for this one: a business intelligence app in the style of Metabase, in Java, with saved questions, a dashboard and a report that is emailed on a schedule. An AI coding agent built it from a project generated by Craft with three AppJars, the AppJars Docs MCP Server and five short specs. Nobody wrote application code by hand: our part was writing the specs and testing the result.

It is not a product. It is a starting point to play with, and everything is open source: the specs, the prompts, the code, and a Git history with one commit per step. github.com/AppJars/appjars-ai-bi
Why build your own? #
Metabase is a great product. This is for teams that want reporting as part of their own Java application instead of next to it, and there are good reasons to want that:
- Reports inside the app your users already open. The questions and the dashboard are views of your application, behind the same sign-in, with the same look. Nobody needs a second tool, a second account or a link to a different domain.
- New reports without a release. Data Query keeps each question as a stored definition: the query, its typed parameters and its result columns. Administrators publish a new report, a new column or a new chart from a screen, and the parameter form, the grid, the export and the chart come from that definition. No Java code and no redeploy.
- Your data, wherever it lives. A question can use SQL against your database, HQL against your own entities, or a REST call to another system, and the grid, the charts and the dashboards work the same for all three.
- Scheduled work your admins can see. Process Manager runs Spring beans on a cron schedule and keeps their execution history. An administrator can pause a job, change its schedule, or run it right now from a screen, which is exactly what you want the first time someone asks “can I get this report today?”.
- The security your company already asks for. User Manager brings sign-in through OAuth2 / OpenID Connect and access rules that administrators change at runtime. In this app the analysts see the dashboard and the questions, and only administrators see the query definitions.
- Extend it in Java. The weekly email is a plain Spring bean that executes the saved questions
through a Data Query service and sends the result. If you can write a
Runnable, you can add the next scheduled report. - A foundation someone else maintains. The modules get fixes and Vaadin and Spring upgrades
through a version bump in
pom.xml. Why that matters for apps built with AI.
Here are the steps, with what actually happened in each one.
Step 1: Start from a project that already runs #
Open craft.appjars.com and pick three modules:
- Data Query for saved questions, parameter forms, charts and dashboards.
- Process Manager for scheduled tasks with cron expressions and their history.
- User Manager for sign-in, users, roles and access rules.
We named the application Insights, kept the in-memory H2 database and the Docker option, and gave the Lumo theme a friendly blue and a slate grey, with a 6px corner radius.
The download is a Spring Boot 4 and Vaadin 25 project with security, navigation, properties and
the theme already set up for those modules. It boots with mvn spring-boot:run, and it contains an
AGENTS.md that tells a coding agent how the project is put together and which rules are easy to
break. Read more about Craft.
Step 2: Let the agent read the documentation #
An agent that has never seen a library will still write code for it, with plausible class names and invented property keys. The AppJars Docs MCP Server fixes that by letting it search the documentation while it works. With Claude Code:
claude mcp add appjars-docs -- npx -y @serverless-dna/mkdocs-mcp https://docs.appjars.com/ "Official AppJars documentation"
The repository also commits a .mcp.json, so everyone who clones it gets the same setup.
Configurations for Cursor, VS Code, Windsurf, Codex, Gemini CLI and JetBrains are on
mcp.appjars.com. Read how the MCP server works.
Step 3: Write the what, not the how #
Each spec is a small Markdown file with a goal, numbered requirements, what is out of scope, and acceptance criteria you can check by hand.
| Spec | What it asks for |
|---|---|
00-principles.md | Rules that apply to every spec |
01-metabase-look.md | A light sidebar, one friendly blue, soft borders, cards and a Questions page |
02-sample-data.md | A fictional outdoor-gear shop with a year of orders, generated with a fixed seed |
03-questions-and-dashboard.md | Four saved questions with line, bar and donut charts, and a dashboard |
04-scheduled-report.md | A weekly sales email, scheduled with Process Manager, delivered to a local inbox |
05-home-and-users.md | A home page with the last 30 days in numbers, and two users who are not admins |
STATUS.md | Where the agent reports what it did and what it dropped |
A BI tool with no data is an empty screen, so spec 02 invents a business: Trailhead Supply, an online shop with thirty products, three hundred customers in six countries and about 2,500 orders over the last twelve months, with a holiday peak and the odd refund. Those are the application’s own tables, so plain SQL is fine there. Everything that belongs to an AppJar, like the questions, the dashboard, the process and the users, has to be created through the AppJars services.
The principles file also does something new this time: it spells out the free-mode limits. Without a license, Data Query allows five questions and one dashboard, User Manager five users, and Process Manager a small number of processes. The demo has to fit, and leave room to play.
No secrets, nothing external. Email goes to a local SMTP catcher (Mailpit). No API keys, no cloud services, no real addresses.
That rule is why the weekly report lands in Mailpit, a small mail catcher with a web inbox that runs next to the app in Docker. Nothing leaves your machine, and you still get to see the real email.
Step 4: Run one short prompt #
The prompt is short, because the specs carry the detail:
You are working on a Spring Boot + Vaadin application generated by Craft, with three AppJars
already integrated: Data Query, User Manager and Process Manager.
1. Read `AGENTS.md` and every file in `specs/`, starting with `specs/00-principles.md`.
2. Use the `appjars-docs` MCP server to look up how the AppJars work (services, data model, views,
routes, free-mode limits) before writing code that depends on them.
3. Implement specs 01 to 05, in order.
4. After each spec, run `mvn -q -DskipTests package`. When all of them are done, start the app with
`mvn spring-boot:run`, check the log for errors and fix them, then stop it.
5. Update `specs/STATUS.md`: mark each spec done or partial, and list anything you dropped under
"Not done".
Keep it simple. If something gets complicated, drop it and write it down instead of fighting it.
We ran it in a fresh, non-interactive Claude Code session with nothing configured except the AppJars MCP server, and nobody touching the keyboard. It took about twelve minutes. In that time the agent:
- read the Data Query and Process Manager documentation, and checked the exact signatures of the services it needed in the jars before calling them;
- created the four questions, their result columns, charts and the Sales overview dashboard through the Data Query services, including a small value generator so the date range defaults to the last twelve months;
- wrote the weekly report as a
Runnablethat executes the saved questions throughQueryExecutionService, builds an HTML email with the week against the previous one, attaches a CSV and sends it, then registered it in Process Manager for Mondays at 08:00; - kept the analyst and the viewer out of the administration screens with User Manager access rules, and checked those rules through the service;
- added Mailpit to
compose.yaml, booted the app, executed every question to make sure it ran, and wroteSTATUS.md, with two honest gaps: it never saw the email arrive, because Docker wasn’t running, and it never opened a page in a browser.
Step 5: Test it, then iterate #
So we started Mailpit, opened the app and clicked through everything, as the administrator and as the analyst. Then, in Admin › Scheduled reports, we chose Execute now on the weekly report.

It worked on the first try. The dashboard, the questions, the access rules and the email were all there:

But a human reading it noticed things the agent couldn’t. The weekly email listed top products and countries for the whole year. The revenue line opened with a dip, because its first month started on today’s date a year ago and was only partly covered. And every dashboard widget showed its title twice.

We wrote those four findings down as a new spec, 06-test-findings.md, and ran a second, shorter
prompt pointing at it. It took under three minutes: the agent gave two questions optional date
parameters and made the email pass the reported week, moved the default start to the first day of
the month, and turned off the duplicated chart titles.
That loop is the whole method: test it, write the finding as a spec, prompt again.
Step 6: Deploy it #
Craft generated a multi-stage Dockerfile and a compose.yaml, and the agent added Mailpit to it,
so the host needs Docker and nothing else:
docker compose up -d
The app is on port 8080 and the inbox on 8025. The same Dockerfile works on a VPS, Railway,
Render, Fly.io, Google Cloud Run or Azure Container Apps. Before you put it on the internet, move
the database from in-memory H2 to PostgreSQL, point the questions at your own data, replace Mailpit
with your SMTP server, and change the secret key and the demo passwords. The README lists each
setting.
What we took away #
- The agent configured a BI tool, it did not write one. Parameter forms, grids, charts, dashboards, scheduling with history, sign-in and access rules came from three Maven dependencies. The agent’s code is what is specific to this app: the look, the sample data, the questions, the email and the home page.
- “Through the services” is a good rule. Because the questions, the dashboard and the process were created through the AppJars services instead of SQL, they are ordinary records an administrator can open and change on day one.
- Free-mode limits belong in the specs. Writing them down upfront meant the demo fit the first time, with room left for one more question and two more users.
- Local first. Mailpit in the compose file made the scheduled email testable without a single credential.
- Test like a user. The agent ran every query. Only a person reading the email saw that a weekly report shouldn’t show yearly numbers.
Try it #
Clone the repository, run docker compose up -d,
and sign in as admin / admin, or as ana or leo with the username as the password. Run the
weekly report from Scheduled reports and open http://localhost:8025. Then write your next spec:
point the questions at your own database, add a printed PDF report, drill down from a chart to the
orders behind it. Run the prompt and test it.
To start your own application, pick its modules on Craft and connect your assistant to the documentation. Every AppJar works in free mode without a license or an account, with limits that are enough to evaluate it. A license lifts the limits without changing a line of code.
Want to see another one? Build your own Redmine in Java with AI and AppJars does the same with an issue tracker. And tell us which application you would like to see built this way next.
Metabase is a trademark of its respective owner. This project and AppJars are not affiliated with or endorsed by Metabase.


