Skip to content
← Back to projects

2026

Matemáticas

PDF maths exercises platform for teacher Juan Manuel Rubio Muñoz.

Matemáticas is the platform where teacher Juan Manuel Rubio Muñoz publishes his worksheets. Students browse by category and school year, filter by difficulty or time, save favourites and download the PDFs with their account. The site is already in use, in a testing phase while the teacher uploads the catalogue bit by bit.

Client
Juan Manuel Rubio Muñoz, maths teacher
My role
Design and development

Screenshots

The screenshots use sample data: the real catalogue is still being filled in and access is restricted during testing.

Matemáticas home page: the title “Ejercicios de Matemáticas” over a 3D grid with floating maths symbols, a search box and the school-year selector.
Home. 3D symbols over a grid, search and the student’s school-year selector.
The Calculus category with its subcategories (Limits, Derivatives, Integrals) and document cards showing school year, difficulty, time, tags and downloads.
Category. Subcategory tree and documents with school year, difficulty, estimated time and tags.
Page of the document “Derivadas: regla de la cadena” with its details and a viewer showing preview page 1 of 2, out of 6.
Document. The viewer only shows a preview (2 of 6 pages); the full PDF is downloaded with an account.
Matemáticas home page on a phone, with the school-year selector, the title and the search box.
Mobile. The same home page, with navigation in a menu.

Architecture

A React SPA deployed on Vercel alongside its serverless functions. Supabase provides login and the database, and files live on Cloudflare R2.

  1. 01

    Frontend · Vercel

    • React 19, TypeScript and Vite

      React Router for the public site, the student area and the admin panel.

    • TanStack Query

      One cached hook per resource, on top of a services layer.

    • Tailwind CSS and shadcn/ui

      Accessible components built on Radix, with light and dark themes.

    • react-pdf and Three.js

      The PDF viewer and the 3D background on the home page.

  2. 02

    API · serverless functions on Vercel

    • Upload, download and preview

      They check the Supabase token and, for writes, that the user is an admin.

    • LaTeX compilation

      Sends the project to a compilation service and stores the resulting PDF.

    • SEO

      Dynamic sitemap and a preview card for each document when its link is shared.

  3. 03

    Services

    • Supabase

      Email or Google login, and PostgreSQL with row-level security (RLS).

    • Cloudflare R2

      PDFs and LaTeX projects, served through signed links.

    • Resend

      Email alerts about new documents.

How data flows

  1. The browser reads categories, school years, tags and documents straight from Supabase with the public key; RLS policies only allow reading the catalogue and keep writes for admins.
  2. For the viewer, the API returns a signed link that expires after 30 minutes, and the viewer only shows the first pages: 2 if the document has fewer than 10, otherwise 20%.
  3. On download, the API checks the session, counts the download and saves it to the student’s history.
  4. The teacher uploads a PDF or a zipped LaTeX project from the panel; for LaTeX, the API compiles it and stores the PDF on R2.
  5. When a document is published, everyone who has its category, a parent category or its school year in their favourites gets an email.
  6. When WhatsApp, LinkedIn or another bot requests a document link, Vercel spots it by its user-agent and serves a page with the document’s title and description.

Technical challenges

Access policies that called themselves

To know whether someone is an admin, the RLS policies queried the profiles table, and the profiles table itself had a policy like that: PostgreSQL went into infinite recursion. I fixed it with an is_admin() function using SECURITY DEFINER, which reads the table without going through its policies, and used it in every write policy.

Opening the site gradually

The catalogue is still being filled in, so the site couldn’t open to everyone at once. A testing mode with an allowlist of emails is checked in both the frontend and the API, and is switched on or off with an environment variable, without touching code.

Swappable storage

One layer with the same interface (upload, read, delete, list and signed link) and three implementations: local disk, Cloudflare R2 and Supabase Storage. Development needs no cloud credentials, and switching provider means changing one variable.

An SPA that shares well

An SPA has no title or description until JavaScript runs, so a shared document would show an empty card. A Vercel rule spots bots by their user-agent and sends them to a function that generates the Open Graph tags for that document.

Categories of any depth

Each category points to its parent, so the tree can have as many levels as the teacher needs. Filtering by a category includes its descendants, and new-document alerts walk up the chain to reach anyone following a parent category.

What I’d do differently today

  • Tests from the start, with Vitest for the logic and Playwright for the flows, and CI on every change.
  • Types generated from the Supabase schema instead of written by hand.
  • Full-text search in PostgreSQL instead of fetching 200 documents and filtering them in the browser.
  • RLS policies designed with is_admin() from the first migration, rather than fixed afterwards.

Stack

  • React
  • TypeScript
  • Vite
  • Supabase
  • PostgreSQL
  • Tailwind CSS
  • Three.js
  • Vercel
  • Cloudflare R2
← Back to projects