JJachAI

How it's built

A test result should still make sense after it ends.

That one idea shaped the design. The server owns time and scores, published questions keep their version, and a payment or an AI answer is never trusted just because a browser says so.

349Java source files
182API endpoints
46MongoDB collections
717Java tests
167Browser checks

The big picture

One server, one database and a few clearly marked connections to the outside world.

Browser

What the person sees

  • Plain HTML, CSS and JavaScript
  • No build step to run it
  • English and বাংলা
  • Sign-in token kept in memory only

JachAI server

Java 21 and Spring Boot 3

Controllers42 classes. Check every input. Services48 classes. Rules, roles and organization checks. RepositoriesEvery query carries the organization.

Data

Where everything is kept

  • MongoDB: accounts, tests, attempts, orders and logs
  • Redis: rate limits and daily AI quotas

Connected at the edges

AIGroq and Gemini, with automatic fallback.
EmailResend, over SMTP.
Sign-inEmail and password, or Google.
PaymentsSSLCommerz, bKash and a demo checkout.

From code to the web:

One request, step by step

What happens between a click and the answer on screen.

  1. Browser sends

    A call to the API with the access token.

  2. Security filter

    Checks the token signature and expiry.

  3. Controller

    Validates the input and rejects bad requests early.

  4. Service

    Checks membership, role and plan limits.

  5. MongoDB

    Reads or writes. Every query includes the organization.

  6. Response

    A result, or an error that says what to do next, in your language.

Two flows worth knowing

The places where trusting the browser would be a mistake.

A payment

  • Created
  • Checkout ready
  • Verified
  • Applied

Only the server can move a payment forward. Coming back from the payment page grants nothing by itself. When a payment is applied, the plan is extended and a receipt is emailed. A cancelled payment stops the flow.

An AI request

  • Ask the first provider
  • Fails or too slow
  • Ask the second provider
  • Answer

If the first provider fails or takes more than 25 seconds, the second one answers instead. The daily limit is charged once, and a provider that keeps failing is skipped for two minutes.

What it is made of

A small number of parts, each with a defined job.

Backend

  • Java 21
  • Spring Boot 3.5
  • Spring Security
  • Spring Data MongoDB
  • Thymeleaf
  • Maven

Frontend

  • HTML
  • CSS
  • JavaScript modules
  • No framework
  • English and বাংলা

Data

  • MongoDB Atlas
  • Redis

AI

  • Groq
  • Google Gemini
  • Spring AI

Integrations

  • Resend email
  • Google sign-in
  • SSLCommerz
  • bKash

Quality and delivery

  • JUnit and Mockito
  • Browser journey checks
  • Docker
  • Render
  • GitHub

Problems that changed the design

Each decision answers a failure we could point to.

Answers can arrive late or twice.

FixThe server sets the deadline, and submitting is safe to repeat.

One person has several roles.

FixRoles belong to an organization, and personal practice stays outside official scores.

Networks retry and providers disagree.

FixEmails, quotas and payments use unique ids, so a repeat never counts twice.

A browser redirect can lie.

FixA payment is applied only after the server confirms it with the provider.

AI can fail or be slow.

FixA second provider takes over automatically.

A stolen token is dangerous.

FixThe access token lives in memory. The renewal token is an HttpOnly cookie that works once.

One database query once stopped the whole app.

FixA derived sum over money failed at startup, so it became a hand-written aggregation.

Hard words lock people out.

FixEvery screen has plain English and Bangla, and errors say what to do next.

Run it yourself

Five steps from nothing to a working copy on your machine.

  1. Get the code

    Clone the repository.

    git clone https://github.com/Nazmul142965/jachAI.git
  2. Point it at MongoDB

    A local one works.

    $env:MONGODB_URI = "mongodb://localhost:27017"
  3. Start the demo

    One script starts it with demo roles.

    scripts/start-local.ps1 -Demo -Port 8102 -DatabaseName jachai_demo_ui
  4. Open it

    Visit port 8102 and choose a demo role.

    http://localhost:8102
  5. Run the tests

    Java first, then the browser journeys.

    ./mvnw test node src/test/frontend/run-journeys.js

Where to look first

The code is split by what it is for, not by technical layer.

authSign-in, sessions and passwords.
organizationWorkspaces, members and roles.
question, assessmentQuestions and versioned tests.
attemptTimed attempts and answers.
academyCourses, batches and certificates.
talentCampaigns and hiring decisions.
billingPlans, usage and payments.
ai, practiceThe tutor, question drafts and practice.
messaging, support, mailChat, tickets and email.
platformAdmin tools for the operator.

The repository also has SYSTEM.md, ARCHITECTURE.md, BACKEND.md and FRONTEND.md for the longer story.

What is checked, honestly

Evidence is useful. It is not a production stamp.

Checked on the live site

  • All six demo roles, from sign-in to results.
  • The AI Tutor and question drafts with real providers.
  • Checkout links for SSLCommerz and bKash.
  • A custom domain on Render with HTTPS.

Still to confirm

  • Receipt and invitation emails arriving in a real inbox.
  • A payment finished at the SSLCommerz or bKash sandbox.
  • Behavior under real load on the free hosting plan.

Take a look inside

Try the product first, then read how it works underneath.