Back to articles

Building Sarion: An AI-first web app with JavaScript, Gemini 2.5 and Mastra AI

Sarion logo

Published on 7/31/2025

Sarion is a web application that combines task and note management with a smart AI assistant, accessible from desktop and mobile, inside a modern and minimalist interface.

But behind the simple user experience hides a solid technical system, designed to be responsive, extensible, and scalable from the start.

In this article I’ll share the stack I chose, the technologies I used, and some behind-the-scenes project decisions.

Everything was built in JavaScript (both frontend and backend) in about 4 weeks, by just one person — yes, with a some days of windsurfing thrown in.

A real AI assistant, thanks to Mastra AI

At the heart of Sarion is Mastra AI, an open-source JavaScript framework for AI agents designed to orchestrate LLM models in real-world environments.

Mastra AI Screenshot

Mastra provides a clear structure for building multi-step agents with integrated tools, controls, and security.

What Mastra offers:

  • Modular architecture for tools, prompts, and agentic reasoning
  • Native support for models like Gemini, OpenAI, Claude, Mistral, Ollama
  • Agent lifecycle management through runtime context
  • Integrated events, tracing, logging, and debugging tools
  • Full JavaScript / Node.js (no Python required)
  • Native edge runtime and streaming

In Sarion, I use Mastra to orchestrate an AI agent that understands natural prompts, breaks down complex tasks, decides what to do (create tasks, ask for clarifications, etc.), and calls the appropriate tools.

All while maintaining control, transparency, and performance.

Gemini 2.5 Flash and Pro as AI models

For the language model I chose Gemini 2.5 Pro and Flash by Google, through Vertex AI.

Both models offer multimodal understanding, advanced reasoning, and very low latency, with key differences:

  • Gemini 2.5 Flash is optimized for quick and low-cost responses.
  • Gemini 2.5 Pro has more sophisticated reasoning capabilities and supports complex tasks.

Currently Sarion works only with Gemini 2.5 Flash, but it is ready and tested to support Gemini 2.5 Pro as well, once the user base is large enough to subsidize its use for free plan users (even if only to a limited extent).

Next.js 15 for frontend and app server

The application is built with Next.js 15, fully leveraging all the latest features:

  • App Router with nested layouts and server components
  • Support for Edge Functions on AI-critical routes
  • Built-in optimization for streaming via Server-Sent Events
  • Dynamic routing, caching, and native API routes

Next.js makes it possible to keep frontend and backend in the same project, maintaining the typical consistency of a monorepo, but with extremely optimized deployments.

Deploy on Vercel

Sarion is deployed on Vercel, which offers:

  • Automatic deployments from Git
  • Native support for Edge Functions
  • Integrated global CDN
  • Excellent performance for both static and dynamic frontend

Vercel integrates perfectly with Next.js, minimizing infrastructure setup and making deployment a non-issue.

Stripe for payment management

The app offers a free plan and a paid plan (with extended AI support).

For billing, I integrated Stripe, using the Checkout API + webhooks.

Stripe handles:

  • Secure authentication
  • Recurring plans
  • Automatic updating of user status (via webhook)

FE/BE communication with Upstash Redis

One requirement was to notify the frontend in real time when the AI agent finishes a reply (or a complex reasoning cycle).

For this I use Upstash Redis with Pub/Sub:

  • The AI publishes events on a Redis channel
  • The frontend (via Server-Sent Events) listens and updates the UI
  • Everything is serverless, scalable, and easily integrated

This system replaces more complex solutions like WebSocket servers, keeping the MVP project lightweight.

How long does it take to build something like this?

The classic question: “Okay, but how much time does it take and how many people?”

Just me, in 4 weeks, between coding and windsurfing.

Of course, knowing the stack well helps: JavaScript, Next.js, AI APIs, agent orchestration…

But I think it’s a good demonstration of what you can do today with even a minimal team, as long as you start with the right tools and a focused idea.

Windsurf Editor Screenshot

Conclusions

Sarion is a real project, used by real users, built on a modern, serverless, and AI-first stack.

If you’re interested in applied artificial intelligence, rapid MVPs, micro teams, or simply how to build an AI-first web app with a modern stack, subscribe to the newsletter or keep following the blog.

👉 Try Sarion at getsarion.com – even just to see how it performs.

Tell me about your idea

Do you have an idea you want to turn into reality? Contact me to discuss how I can help you build your MVP.

Contact me