TuranOkul Learning Management System
A practical learning management system for the Turan ecosystem
November 2026
📚 Documentation Structure
The proposal is organized around the following areas:
- 1. Summary
- 2. Scope
- 3. Technology stack
- 4. Architecture overview
- 5. Domain model
- 6. Administration panel (Laravel MVC)
- 7. API layer: REST first
- 8. Background processing (Laravel Horizon)
- 9. Realtime (Release 2, Laravel Reverb)
- 10. Data layer
- 11. Statelessness and replication
- 12. Security, privacy and multi-tenancy
- 13. Study App (React/Vite)
- 14. Student App and Parent App (React/Vite)
- 15. Deployment on the TuranOrdo Containerized PHP runtime
- 16. Observability, testing and quality
- 17. Delivery plan
- 18. Risks and open decisions
- 19. Assumptions to confirm
- 20. Capacity profile, sizing and triggers
- 21. Decision log
- 22. Sponsorship, validation and future development
1. Summary
Status: Proposal (draft), scoped for a small team and an MVP. Not an available product.
Last updated: 22 November 2026
Part of: the Turan ecosystem, as a future project of the TuranBilgi business.
Sponsorship: TuranOkul is looking for a Turkish school or education institution to act as sponsor and design partner (section 22). No investment is being solicited.
TuranOkul is a multi-branch learning management system for educational institutions such as schools, exam-preparation institutes and their branches. This proposal first defines a small-team MVP (Release 1) that can run a pilot with a few institutions, and then lists what later releases add. Staff use a server-rendered administration panel. Students use a Student App and a dedicated Study App for books and exams. A Parent App follows in Release 2. A stateless Laravel monolith with a shared domain layer owns the business logic and the security model, and exposes a REST API as its primary interface. TuranOkul runs on TuranOrdo’s Containerized PHP runtime: its own PHP-FPM replicas, workers and scheduler sit behind TuranOrdo’s Traefik and a web gateway (the shared Nginx), and PostgreSQL, Redis and MinIO object storage are provided by TuranOrdo. TuranOkul also serves as the first real PHP system to validate TuranOrdo’s Containerized PHP runtime, and continuing beyond validation depends on a sponsor institution that provides a real context (section 22).
The design rests on six principles:
- Start small, keep doors open. Build a thin vertical slice first (one institution: booklet, attempt, score, result). Defer what a pilot does not need, and keep the design ready for it (section 2.2).
- One application core. All business rules live in a shared layer of services, policies and actions (section 4.2). The admin panel, the REST API and the queue jobs are thin adapters over it, so business logic cannot drift between them, and another adapter can be added later without touching the rules.
- One database type. PostgreSQL holds both the core data and the audit trail, so a change and its audit record commit or roll back together.
- One origin per audience. Staff, students and parents each have their own hostname, account table, guard and session. Each app calls the API on its own origin, so there is no CORS and the stock Sanctum flow applies.
- One repository for the product. The backend, the client apps and the shared packages live in one monorepo, so a change to the API and to its clients lands together. Each app is still built and deployed independently.
- Application-owned runtime on platform infrastructure. TuranOkul owns its PHP image and process roles. TuranOrdo owns the container lifecycle, the edge, the shared Nginx, PostgreSQL, Redis and object storage, so the application containers hold no state.
2. Scope
2.1 In scope for Release 1 (MVP)
- Organization: institutions, branches and classes; staff accounts with role-based access control (platform admin, institution owner, branch manager, teacher, content manager); student accounts, created manually or imported from Excel.
- Curriculum: standard learning outcomes (“gains”, seeded as reference data) and institution-specific content trees.
- Library: exam booklets (a PDF converted into page images, with question regions, an answer key, and gain, content and difficulty tags), plus PDFs and external video links as simple resources.
- Access: packages that group contents and resources, manual enrollment of students and classes, and computed entitlement.
- Exams: the Study App flow: start, answer, autosave, submit, asynchronous scoring, results and answer review.
- Results: per-student and per-gain results in the Student App and the admin panel, with CSV export.
- Cross-cutting: audit trail, email notifications (accounts and results), TOTP for platform staff, and operational monitoring.
2.2 Later releases (designed, not built in the MVP)
- Release 2: Parent App and guardian accounts; homework; live-lesson scheduling (links to an external provider); question booklets composed by rule; hotspots and annotation drawing in the Study App; study plans and study-duration parameters; gap lists and remedial booklets; package sale windows, sub-packages, comments and agreements; notifications and realtime (Reverb); TOTP for all staff.
- Release 3: external (paper) exams with optical forms and DAT import; online payments; CDN and multi-node scaling; GraphQL and service credentials for integrations, if a need appears.
2.3 Out of scope (see the assumptions in section 19)
- The marketing website. It is a separate project outside these repositories and only links to the app hosts.
- Hosting live video itself (assumed to be an external integration).
- Payment processing internals (assumed to be an external integration).
- Native mobile apps (the React apps can be delivered as PWAs).
- A public third-party API.
3. Technology stack
| Layer | Choice (MVP) |
|---|---|
| Application | Laravel monolith (MVC), current stable PHP and Laravel releases, organized as a modular monolith around a shared domain layer (section 4.2) |
| Admin UI | Blade, Tailwind CSS, Alpine.js for light interactivity, one React island for the region editor, built with Vite |
| API |
REST/JSON, versioned under /api/v1, same-origin per app host. OpenAPI generated from code
and a typed TypeScript client generated from it. GraphQL is deferred (section 7)
|
| Authentication | Laravel session authentication through Sanctum’s stateful SPA mode: same-origin, host-only cookies, one guard per audience selected by host |
| Database | PostgreSQL provided by TuranOrdo (core data and audit trail) |
| Queues, cache, sessions | Redis provided by TuranOrdo (one instance in the MVP) |
| Background workers | Laravel Horizon |
| Realtime | None in the MVP (polling). Laravel Reverb in Release 2 |
| Object storage | TuranOrdo’s MinIO (S3-compatible), used through Laravel’s S3 disk with presigned URLs for browser uploads and downloads. A CDN can be added in front later |
| Client apps | React + TypeScript + Vite: Study App and Student App in the MVP, Parent App in Release 2 |
| Repository | One monorepo: Composer for the backend, pnpm workspaces for the apps and shared packages |
| Runtime and edge | TuranOrdo Containerized PHP runtime: Traefik (edge router) → web gateway (shared Nginx, or a dedicated Nginx for the student host) → TuranOkul’s private PHP-FPM replicas. Workers and the scheduler run as separate containerized roles. PostgreSQL, Redis and MinIO are provided by TuranOrdo |
4. Architecture overview
Browsers
org.{turanokul} student.{turanokul} parent.{turanokul}
Admin panel / Student App Parent App
(Blade + React island) /study/ Study App (Release 2)
| | |
+---------- Traefik: public ingress, TLS, host routing -----+
|
Web gateway (shared Nginx, or dedicated for student host)
static files: Student App, Study App, admin assets
/api, /sanctum, admin pages -> FastCGI
|
PHP-FPM replicas (TuranOkul, private)
worker (Horizon) scheduler (1) separate roles, same codebase
|
+----------------+-----------+-------------------+
| | |
PostgreSQL Redis MinIO object storage
(TuranOrdo) (TuranOrdo) (TuranOrdo)
Process roles, separate containerized roles built from one codebase (section 15):
-
web: private PHP-FPM replicas serving the admin panel and the API. One group, no published port. -
worker: Horizon queue workers. -
scheduler: a single instance. - The Student App, the Study App and the admin assets are static files served by the web gateway (the shared Nginx, or a dedicated Nginx for the student host).
- There is no WebSocket server in the MVP.
“Stateless” here means the application containers hold no state. The system as a whole still has state, concentrated in PostgreSQL, Redis and object storage. Those three are the availability-critical components.
4.1 Hostnames, origins and audience isolation
| Host | Purpose | Guard |
|---|---|---|
org.{turanokul}
|
Administration panel for institutions, branches, managers, teachers, content managers and platform
staff, with its same-origin /api
|
staff
|
student.{turanokul}
|
Student App at / and Study App at /study/, two separately built apps on
one origin, with the same-origin /api
|
student
|
parent.{turanokul}
|
Parent App (Release 2), with its same-origin /api
|
guardian
|
storage.{turanokul}
|
MinIO S3 endpoint for browser presigned uploads and downloads, reached through Traefik (to confirm). A CDN can later sit in front | none |
ws.{turanokul}
|
Reverb WebSocket server (Release 2), routed by Traefik directly to the Reverb service. No cookies | none |
api.{turanokul}
|
Reserved for server-side integrations with service credentials (Release 3 at the earliest). No cookies, no CORS | none |
{turanokul}
|
Marketing website: a separate project, not part of these repositories | none |
Rules:
-
Same-origin per audience. Each app host serves its own
/apiand/sanctumroutes. Traefik routes every host to the web gateway, which forwards these paths to the same PHP-FPM replicas. No cross-origin request exists, so there is no CORS configuration and no preflight cost. -
Stock Sanctum flow. The app fetches the CSRF cookie, signs in, and the session cookie is
host-only (
__Host-prefix,Secure,HttpOnly,SameSite=Lax). The CSRF cookie is readable by the same host’s scripts. -
Audience from the trusted host. Laravel accepts only the configured hosts and maps each
to an audience:
org.tostaff,student.tostudent,parent.toguardian. The audience selects the guard and the operations mounted. The operation bus also rejects any operation whose declared audiences do not include the actor’s type, so a mis-routed request still fails. -
Path routing at the gateway. Traefik routes each host to a web gateway: the shared Nginx
if its registry can express ordered routes per host, otherwise a dedicated Nginx container for
student.{turanokul}(section 15). In the student host,/apiand/sanctumgo to PHP-FPM through FastCGI,/study/serves the Study App with its ownindex.htmlfallback, and everything else serves the Student App. -
One student session for two apps. The Student App and the Study App share the student origin and therefore the session. They stay independent builds with separate release cycles. Browser storage keys are namespaced per app, and only the Study App registers a service worker (scope
/study/). - Why the Study App is not on its own host. A separate host would have its own host-only session and force a second sign-in. Sharing a cookie across subdomains would expose it to every subdomain. A path on the student origin avoids both.
-
Why there is no central API host. It would require credentialed CORS, origin-to-audience
mapping and a custom CSRF flow, which a small team does not need. The cost of the same-origin model is that
each host routes
/apito the backend. First-party apps do not need a single base URL. - Institution domains. The same-origin model would also work for institution-specific domains later, if each domain routes the same paths, but tenant resolution by host and certificate issuance are outside the MVP.
4.2 Shared domain layer: services, policies and actions
All business logic lives in one shared layer inside the Laravel application. The admin panel, the REST API, queue jobs and scheduled commands are adapters. They contain no business rules. A rule is written once and is identical for every entry point, which prevents drift and means a new feature needs its logic, authorization and tests written only once. Because the layer is transport-agnostic, another adapter (GraphQL, section 7) can be added later without changing the rules.
| Layer | Responsibility | May depend on |
|---|---|---|
| Adapters | Blade controllers, REST controllers, jobs and commands. Parse transport input into typed inputs, call the operation bus or a query, map results and domain errors back to the transport | The operation bus and queries only |
| Operation bus | The pipeline run for every write: resolve the actor and tenant, check the audience, validate the input, authorize through the policy, apply idempotency, open the transaction, run the action, write the audit event, dispatch events after commit | Actions, policies, audit sink |
| Actions | One per business operation, such as AssignPackageToStudent. Orchestrate services inside the transaction and return a domain result | Services, models, events |
| Services | Reusable business rules and algorithms: entitlement, scoring, package assignment. Used by actions, jobs and commands | Models and other services through module interfaces |
| Policies | Authorization rules shared by every adapter: staff permissions and scopes, student ownership | Models and the actor interface |
| Queries | Filtered, sorted and paginated reads, shared by admin tables and API lists, always tenant-scoped | Models |
| Models, events, exceptions | Eloquent models with tenancy scopes, domain events, and domain exceptions that map to error codes | none |
Rules:
- Adapters hold no rules and never write models directly. Writes go through the operation bus and an action. Reads go through queries.
- One authorization path. Policies take an actor abstraction (
staff,student, laterguardian), so the same policy method answers “may this actor perform this operation on this subject” for every adapter. - One validation definition. Input rules live in the typed input of each operation. Blade form requests and API requests derive from it.
- Modules are bounded contexts inside the one application:
Identity,Organization,Curriculum,Library,Exams,Commerce,ResultsandAudit. Modules call each other only through public service interfaces or domain events. - The layering is enforced. Architecture tests in CI (Pest architecture tests) fail the build when the domain layer imports HTTP classes, when an adapter touches a model for a write, or when a module reaches into another module’s internals. They are small and cheap to keep.
- Scaffolding. A generator (for example
make:operation) creates the action, its typed input, the policy method, the REST binding, the registry entry and a test skeleton. Shared query objects give admin tables and API lists the same filters.
4.3 Repository layout
One repository holds the backend, the client apps and the shared packages. The Composer project and the pnpm workspace live side by side.
turanokul/ one repository
backend/ Laravel monolith
app/Modules/ bounded contexts: Actions, Services, Policies, Queries, Models
app/Adapters/ Blade controllers, REST controllers, jobs
resources/ Blade views and the island entry point
apps/
study/ Study App (React/Vite) served at student.{turanokul}/study/
student/ Student App (React/Vite) served at student.{turanokul}/
parent/ Parent App (Release 2)
packages/
api-client/ TypeScript client generated from the OpenAPI spec
auth/ login, logout and CSRF handling shared by the apps
exam-viewer/ page viewer and region geometry (Study App and admin region editor)
ui/ UI kit
config/ shared TypeScript, lint and Tailwind presets
infra/ PHP image Dockerfile, release build scripts, TuranOrdo app registration (route model, resource requests)
docs/ proposal sources and decision records
Why one repository for this team and design:
- One small team works on both sides, so one pull request can change the API and its clients together.
- The OpenAPI spec and the generated client change with the backend in one commit.
- The
exam-viewerpackage is shared by the Study App and by the admin panel’s region editor, which is built inside the backend’s Vite pipeline. Separate repositories would require publishing that package to a registry. - One CI pipeline and one release train are enough for an MVP.
What it costs: two toolchains (Composer and pnpm), CI path filters and build caching so only affected parts run, and coarse repository access (code owners route reviews but do not restrict access). Apps and backend still deploy independently, so API changes must stay backward compatible for a release.
When to split: separate teams or vendors, a need for access boundaries, diverging release cadences, or CI times that hurt. The split is then clean: backend in one repository, apps/ and packages/ in another, with the OpenAPI spec and the shared packages published as artifacts.
5. Domain model
Organization and people
- Institution → Branches → Classes. Departments arrive when needed.
- Account types, one table each:
staff_users(platform staff, institution owners, branch managers, teachers and content managers) andstudentsin the MVP, andguardiansin Release 2. - Staff identity is global. One account per email, with roles scoped to an institution and optionally a branch. A teacher working at two institutions has one account with roles in both, and picks an active institution after login. Platform staff hold roles with no institution.
- Students belong to one institution. Identifiers are unique per institution (for example student number or email, configurable per institution).
- Roles and permissions apply to staff only. Permissions are named
<action> <object>, for exampleupdate exam. Students have no roles, and their access is “own data”. - Guardian–student links (Release 2) are many-to-many, with status and consent timestamp.
Curriculum
- Gains are standardized learning outcomes in a hierarchy, seeded as reference data.
- Contents are institution- or branch-defined trees (subject, unit, lesson, and so on). Each content maps to a base gain. Institutions can therefore structure their material differently while analytics stay comparable.
Learning resources
Resources are owned by a branch and tagged with content:
- MVP: exam booklets, built from a PDF converted into page images. Each page carries question regions defined by pixel coordinates, with an answer key and gain, content and difficulty metadata. PDFs and external video links are simple resources.
- Release 2: question booklets composed by rule from exam items, interactive hotspots (linking a page region to a video, a PDF or an explanation), homework, and live-lesson scheduling.
- Release 3: external (paper) exams scored from optical forms or DAT files, with optical form templates and Excel-defined exams.
Commerce and access
- MVP: packages group contents and resources and are assigned manually to students or classes. Entitlement is computed, not copied: a student can access any resource whose content, or whose ancestor content, is in a package they hold.
- Release 2: sale and usage windows, sub-packages, student comments with approval, agreements to accept, study plans and study-duration parameters.
- Release 3: online payment and orders.
Results and analytics
- MVP: attempts, answers and scores, aggregated per student, per gain and per content, with CSV export.
- Release 2: outcome-level “gap” lists of expected gains the student hasn’t yet achieved, feeding auto-generated remedial booklets.
Reference data
- Gains are seeded in the MVP. Schools, universities, programs and qualification data arrive with study plans in Release 2.
6. Administration panel (Laravel MVC)
The panel is served at org.{turanokul} to staff only.
- Default stack: server-rendered Blade views, styled with Tailwind CSS, built with Vite. There is no SPA. Most screens are lists, filters and forms, which Blade handles with the least code. Controllers are adapters: they call the operation bus and shared queries (section 4.2).
- Alpine.js handles trivial local behavior: menus, modals, tabs and dependent selects. Strict content-security policies need Alpine’s CSP-compatible build.
- One React island in the MVP: the drag-to-draw region editor for exam pages. It is a React component mounted into a Blade page through a data attribute with JSON props, built from the shared
exam-viewerpackage, and it calls the same-origin/apiwith the staff session cookie. Later islands (composition rules builder, analytics views) follow the same pattern in Release 2. - Rule for choosing: anything with more than a few fields of state becomes an island. Alpine is not stretched to complex editors.
- Form requests derive their rules from the typed inputs of the operations. Policies and permission checks guard every operation through the operation bus.
- Listing pages share one table/filter component, backed by the same query objects as the API lists. Every entity gets a history button backed by the audit trail (section 10.2).
- Livewire is deliberately not used.
7. API layer: REST first
Principle
There is one action per business operation, such as CreateExamBooklet, AssignPackageToStudent or StartExamAttempt. It takes typed input and returns a domain result. Controllers and jobs only translate between transport and the operation bus, which applies validation, authorization, the transaction and the audit event (sections 4.2 and 10.2). Because operations are transport-agnostic, exposing them on another surface is an adapter, not new logic.
REST conventions
- Same-origin and versioned: each app host serves
/api/v1/..., mounting only the operations of its audience. - Screen-shaped reads. Dashboards use dedicated read endpoints (query objects) that return what a screen needs, instead of many generic calls. HTTP/2 through Traefik makes the remaining parallel calls cheap.
- API Resources for response shaping, cursor pagination, and consistent filter and sort conventions.
- Errors use problem+json with stable error codes mapped from domain exceptions.
- Idempotency keys on retry-prone writes (starting and submitting an attempt), stored in Redis.
- HTTP caching: ETags and conditional GETs for reference data such as gains and content trees.
- Rate limits per route and per audience, with counters in Redis.
- No multipart uploads through the app. Large files use two operations around a presigned direct-to-storage upload.
Contract and consistency
- The OpenAPI document is generated from the code (for example with Scramble, whose accuracy needs verification in Phase 0) and committed. The TypeScript client in
packages/api-clientis generated from it (for example with openapi-typescript). - CI regenerates the spec and fails if the committed one is stale, and checks for breaking changes against the previous release (for example with oasdiff).
- An operation registry lists each operation with its audiences, permission and REST binding. CI fails if a route is not bound to a registry operation.
- Architecture tests keep controllers free of business logic (section 4.2).
Authentication and authorization
- Sessions, not tokens. The apps use Laravel session authentication through Sanctum’s stateful SPA mode. React apps keep no credentials in script-readable storage.
- One guard per audience (
staff,student, laterguardian), selected by the request’s host (section 4.1). Sanctum with several guards selected per host is not the stock setup and needs a Phase 0 spike. - MFA. Staff accounts support TOTP, mandatory for platform staff in the MVP and for all staff in Release 2. Student accounts use passwords.
- The same policies and permission checks run for every adapter, because they sit in the shared layer.
- Login attempts are rate-limited per account and per IP.
- Revocation is described in section 10.3.
GraphQL (deferred)
GraphQL is not built in the MVP. For a small team building both sides of a first-party product, REST with a generated OpenAPI client has fewer moving parts, supports HTTP caching and per-route limits, and avoids the extra controls GraphQL requires. It can be added later as another adapter over the same operations if a concrete need appears:
- screens that need flexible nested reads which dedicated endpoints handle poorly,
- a second client team, or a mobile app that benefits from client-shaped queries,
- many one-off dashboard variants.
If it is added, the starting rules are: one schema using audience guards, persisted queries enabled at launch hardening, depth and complexity limits, a cap on operations per request, and rate limits per executed operation.
Integrations and special clients (later)
- Server-side integrations and non-browser clients would use REST at
api.{turanokul}with scoped service credentials (for example Sanctum tokens with abilities), bound to one institution, restricted to an operation allowlist, rate-limited and audited as actor typeintegration. This is designed now and built when the first integration needs it. - OAuth 2.0 (Passport) is only introduced if third-party developers or an identity-provider role become requirements.
8. Background processing (Laravel Horizon)
Queues run on Redis, supervised by Horizon in a single worker container (scaled by replicas when needed). Separate queues keep heavy work from starving user-facing work. Queue dispatch uses after_commit, so jobs never run before their data is committed.
| Queue | Examples | Notes |
|---|---|---|
default | Light domain events | Small, fast |
scoring | Exam attempt scoring | Latency-sensitive; high priority at exam peaks |
files | PDF → page images, thumbnails | CPU/memory heavy; limited concurrency |
integrations | Retry with backoff | |
imports | Excel student imports | Chunked; progress available by polling |
Queues for notifications fan-out and reports arrive in Release 2. Scheduled sweepers expire overdue attempts, re-dispatch attempts stuck in submitted or scoring, and create audit partitions ahead of time.
Job conventions
- Jobs and commands are adapters too. They call actions and services through the shared layer and never duplicate business rules (section 4.2).
- Every job is idempotent, with explicit retries, backoff and timeouts, and a correlation ID in its logs.
- Multi-step pipelines use job batches with status exposed to the admin panel by polling. For example, booklet PDF → page images → thumbnails → “ready” state.
- Failures are visible in Horizon and surfaced to the user who triggered the work.
- Payloads carry identifiers, not blobs. The Horizon dashboard is restricted to platform staff.
- Every job must work on any worker container: sources are pulled from object storage into ephemeral temp space, and outputs are pushed back.
- Jobs that change data record their audit events in the same transaction as the change.
Heavy workload to prototype early
- PDF-to-image conversion at scale, calling poppler or Ghostscript directly for rasterization and libvips for resizing, as command-line processes with explicit timeouts. Scanned PDFs, large files and unusual fonts should be tested early.
- Optical form reading and DAT import are Release 3 and are not prototyped in the MVP.
9. Realtime (Release 2, Laravel Reverb)
The MVP has no WebSocket server. Results and conversion status are fetched by polling with exponential backoff, and email covers notifications. This removes a process, an event-loop extension, connection limits and a client library from the first release.
- When to add Reverb: a requirement for instant notifications, admin progress streaming that polling handles poorly, or polling load that becomes noticeable (section 20).
- Kept ready: domain events are broadcast-ready, and the clients wrap result retrieval in one module, so switching from polling to sockets is local.
-
Design when added: an independent Reverb container, registered with Traefik as an HTTP service
and not part of the PHP-FPM runtime.
- WebSocket traffic reaches it as HTTP Upgrade traffic through Traefik and does not pass through Nginx or PHP-FPM.
- The preferred route is the dedicated host
ws.{turanokul}. Routing/appand/appson the student host with higher-priority Traefik rules is a valid alternative. - Reverb’s internal listen address and port are separate from the public endpoint settings the Laravel app and Echo use (host, port 443, scheme https).
- The apps use Laravel Echo, with private per-account channels authorized through the same-origin
/broadcasting/authroute, an origin allowlist for the app hosts, events that carry identifiers and state only, sockets opened only when needed, reconnect with jittered backoff, and a polling fallback. - Reverb scales through Redis pub/sub, with Traefik spreading connections across replicas.
- Its default event loop caps concurrent connections, so the event-loop extension, a high open-files limit and a load test come with it, and the ping interval must stay below the idle timeouts on the path. Confirm exact thresholds against the current Reverb documentation.
10. Data layer
10.1 PostgreSQL (core data)
- Content hierarchy and entitlement. The computation “package contents → descendant contents → resources” is the main performance risk. Candidate approaches are recursive CTEs,
ltreewith a GiST index, or a maintained closure table. Prototype them with realistic data in Phase 0 and choose by measurement. - Tenancy. Application-level global scopes on
institution_idandbranch_idare the control (section 12). Row-Level Security is not used in the MVP. - Turkish text. Use ICU collations,
unaccentandpg_trgmfor fuzzy name search. Handling of dotted/dotless I (İ/ı) should be tested with real names early. These extensions and collations must be available on TuranOrdo’s PostgreSQL (section 15). - Large tables. The answers table is hash-partitioned by attempt from day one, with a small number of partitions. Starting partitioned is cheap, and retrofitting is painful.
- Connections. The MVP starts without PgBouncer: FPM children and worker processes are sized so total connections stay well below the server limit. PgBouncer is added when connections exceed about 70% of the limit (section 20), after checking prepared-statement and session-level settings under transaction pooling.
- No read replicas in the MVP.
- JSONB fits flexible configuration and audit change sets. Question-region coordinates and gain/difficulty metadata stay as real columns, because they are queried and aggregated.
10.2 Audit trail (PostgreSQL)
Every administrative or security-relevant change produces an immutable audit event. Because the audit row lives in the same database as the data, it is written in the same transaction as the change. There is no state where a change exists without its audit record, or the reverse, and no outbox or relay is needed. Point-in-time recovery also restores data and audit history to the same instant.
Storage
An audit.events table in a dedicated schema, partitioned monthly by occurred_at, with partitions created ahead of time by a scheduled command.
Columns
id(UUID, time-ordered).institution_idandbranch_id.- Actor:
actor_type(staff, student, system; guardian and integration later) andactor_id, IP and correlation ID. - Surface (web, REST or job) and the operation name.
- Entity type and ID, and the action.
changes(jsonb,{field: {old, new}}), plus relationship changes.occurred_at.
Indexes
(entity_type, entity_id, occurred_at desc)serves the per-entity history button.(institution_id, occurred_at)serves tenant-level review.(actor_type, actor_id, occurred_at)serves actor-level review.- A BRIN index on
occurred_atserves time-range scans.
What is audited
- Administrative and configuration changes: accounts, roles, packages, contents, resources.
- Security events: logins, session revocations, permission changes.
- Student attempts and answers are already immutable domain records and don’t need row-level audit.
- Bulk operations such as imports write one summary event (who, what, counts, source file), with per-row events only where the business requires them.
Capture
- The operation bus writes the event inside the operation’s transaction, with full semantic context. This is the primary mechanism, and it applies to every adapter because every write passes through the bus.
- Database triggers as a safety net for raw SQL and manual changes are optional and can be added later on the most sensitive tables.
- Audit code failures fail the business transaction. That is deliberate, since no change goes unaudited, and it means the audit code needs strong tests.
Integrity and privacy
- A dedicated database role has
INSERTon the audit table and noUPDATEorDELETE. A trigger rejects updates, deletes and truncates as a second guard. - Secrets (password hashes, tokens) are redacted before capture. Personal data in change values is minimized, since students include minors.
- Retention works by partition: detach, archive to object storage, then drop, using a separate retention role. Decide the retention period with legal input.
Growth and an exit path
Capture is placed behind an AuditSink interface. If volume ever outgrows the primary, older partitions can be moved out or audit rows streamed to another store without changing the application. Phase 0 estimates audit volume.
10.3 Redis (sessions, queues, cache, coordination)
Redis holds sessions, queues, application cache, atomic locks, rate limits and idempotency keys. The MVP uses one Redis instance configured with noeviction and AOF persistence, because queues and sessions must not be evicted. Cache entries therefore always carry a TTL, and memory is monitored (alert at about 70%). The cache footprint is small in the MVP (manifests, granted-content sets).
- When to split: if cache memory or churn threatens queues and sessions, split into a durable instance (sessions, queues, locks, idempotency keys, rate limits) and an evictable cache instance (section 20).
- Availability: persistence, replication and failover depend on what TuranOrdo’s Redis provides (section 15). A Redis loss signs users out and stops jobs, so a restore or failover rehearsal belongs in pilot hardening.
Sessions and revocation
- Sessions live in Redis. Losing them would sign everyone out, including students mid-exam.
- The authentication guard loads the account row on every request, so setting an account’s status to disabled blocks it immediately.
- A password change invalidates the account’s other sessions.
- “Sign out everywhere” and forced revocation use a small per-account index of session IDs in Redis.
- Staff sessions have shorter idle and absolute lifetimes than student sessions. Exam autosave counts as activity. A session that expires mid-exam must not lose answers: the client queues them and re-authenticates.
Coordination primitives
- Atomic locks for critical sections,
onOneServerfor scheduled tasks, unique jobs andWithoutOverlappingfor queue work, and idempotency keys viaSET NX EX. - Define per use case whether a lock failure fails open or closed.
11. Statelessness and replication
TuranOrdo manages the container lifecycle, and TuranOkul’s PHP-FPM replicas sit behind the web gateway. For replicas to be interchangeable, each of these must hold:
-
Sessions live in Redis, with the same
APP_KEYon all replicas. - Files never rely on local disk. Uploads go to object storage (direct or presigned). Workers pull sources into ephemeral temp dirs and push outputs back.
- Cache, locks and rate limits use Redis only. No file-based cache or local counters.
-
Scheduler runs as a single instance (
onOneServeras a second guard). - Migrations run once per release in a one-off container, not on every container start. Use expand/contract changes so old and new versions can run side by side during a rolling update.
- Releases are immutable and mounted read-only. Configuration and secrets are injected at runtime, and the caches that depend on the environment are generated at container start (section 15).
- Logs go to stdout.
- Horizon can run in several worker containers. Releases terminate it gracefully so in-flight jobs finish.
12. Security, privacy and multi-tenancy
Tenancy. A single database scoped by institution_id and branch_id
through global scopes. Every query path (web, API, jobs) goes through the same scoping, and scope leaks are
covered by automated tests. Row-Level Security, schema-per-tenant and database-per-institution are alternatives
if large clients demand stronger isolation. This remains an open decision (section 18).
Audience isolation. Separate account tables, one guard per audience, host-only session cookies per origin, host-to-audience mapping, and the operation bus’s audience check mean a student session cannot reach staff operations. The separation is logical: one database and one application role serve all audiences, so the protection comes from guards, policies, cookies and routing, not from storage.
Private media. Videos, PDFs and booklet page images are never directly addressable. Entitlement
is checked when the API issues access. Files are served through short-lived presigned URLs signed for the
browser-reachable storage host (storage.{turanokul}, MinIO through Traefik). For attempts, URL
lifetime covers the exam duration plus a margin, or fresh URLs are fetched on demand. If MinIO is not exposed
to browsers, an internal Nginx location proxying to MinIO, reached by an X-Accel-Redirect from PHP,
is the fallback.
Privacy and minors. Student data includes minors, so data minimization, retention rules and access logging need to be designed in from the start. Parental consent flows arrive with guardians in Release 2. Compliance requirements under Turkish data protection law (KVKK) should be reviewed with legal counsel before launch. That review is outside this proposal.
Roles and permissions. Staff hold any number of roles, scoped to an institution and optionally a branch, with one permission per object type and action. Every authorization decision runs through the shared policy layer.
13. Study App (React/Vite)
The Study App is an independent React/Vite app served at student.{turanokul}/study/, with its own
build, release cycle, service worker and content-security policy. It is built for books and exams, and it is
the app students use when an exam is running.
- Entry and session: students arrive by deep links from the Student App, for example to a booklet or an attempt. The session is the student session on the same origin, so no sign-in is repeated and no credentials travel in URLs. A direct visit without a session shows the same login screen, from the shared
authpackage. - MVP features: page-image viewing with zoom and pan, answer selection on question regions, a timer, navigation between questions, autosave, submit, results and answer review.
- Release 2: annotation drawing (Pointer Events and a canvas layer), hotspots, question booklets assembled client-side from item coordinates, and realtime score delivery.
- Resilience: answers are saved locally first and synced in batches about every 15 seconds with jitter, through one batch endpoint. Each answer carries a sequence number, and the newest wins, so retries and out-of-order delivery are safe.
- Results: immediate acknowledgement on submission, score by polling with backoff, then per-question review. Which answers and explanations are revealed follows the booklet’s reveal policy, enforced on the server.
- Delivery: installable PWA with its own service worker (scope
/study/). It caches the app shell and keeps unsent answers locally. Page images come from signed storage URLs with bounded runtime caching, to stay within storage quotas. - Lean by design: it contains only study features and shares the
exam-viewer,ui,authandapi-clientpackages. A change to the dashboard in the Student App cannot break an exam in progress, because the two ship separately.
Exam attempt lifecycle
- Start (
POST /api/v1/exam-attempts) is idempotent, resumes an open attempt, and returns a server-authoritative expiry time and a cached manifest. The manifest never includes correct answers. - During the attempt (
PUT /api/v1/exam-attempts/{id}/answers), answer batches are upserts. The server rejects saves after expiry plus a small grace period. - Expiry is enforced by a scheduled sweeper, so an abandoned attempt still closes.
- Submit (
POST /api/v1/exam-attempts/{id}/submit) locks the attempt row, stores the final answer set, and returns immediately. - Scoring runs on the
scoringqueue, claims the attempt atomically, and writes results and statistics in one transaction. The app pollsGET /api/v1/exam-attempts/{id}with backoff. - Answer-key corrections trigger idempotent rescoring of affected attempts.
14. Student App and Parent App (React/Vite)
Student App (MVP)
student.{turanokul}: a thin app with a dashboard, the student’s packages, available exams with deep links into the Study App, results history, per-gain results, and profile and password.- Release 2 adds homework, a live-lesson calendar, the study plan, notifications, agreement acceptance and purchase history.
- The Student App is online-only in the MVP and registers no service worker.
Parent App (Release 2)
parent.{turanokul}: a linked-student switcher; read-only views of progress, results and homework status; and notifications.- It arrives with guardian accounts, guardian–student links and consent flows. The design reserves the guard and the audience.
Shared foundation
-
The apps share the packages in section 4.3: the generated API client, the
authpackage, the UI kit and configuration. - Suggested stack: TypeScript, Vite, TanStack Query with the generated client, React Router, Vitest and Playwright.
-
Deployment: each app is a static artifact (
student-shell,student-study) served by the web gateway from the release contract in section 15. The Study App has its own content-security policy, and both restrict connections to their own origin and the storage host.
15. Deployment on the TuranOrdo Containerized PHP runtime
Runtime model
TuranOkul uses TuranOrdo’s Containerized PHP runtime, a planned extension: application-owned PHP-FPM workloads reached through a web gateway. Because the runtime is planned, each requirement below is a dependency to confirm.
Internet
|
Traefik edge router public ingress, TLS, host routing
| HTTP \ HTTP Upgrade (Release 2)
Web gateway Reverb service
(shared Nginx, or a dedicated Nginx
for student.{turanokul})
| FastCGI
TuranOkul PHP-FPM replicas (private, no published port)
- TuranOrdo owns the container lifecycle, networking, resource limits, health monitoring, release storage and activation, the shared Nginx integration, service discovery of the replicas, and PostgreSQL, Redis and MinIO.
- TuranOkul owns its PHP image (version, extensions, INI and FPM configuration), application dependencies, builds and release artifacts, and the application.
-
Gateway decision rule. Use the shared Nginx only if its registry can represent a host as
a set of ordered routes (several independent roots, SPA fallbacks and FastCGI rules). Otherwise give
student.{turanokul}a dedicated Nginx container with the same two static roots, fallbacks and FastCGI upstream. That is the planned dedicated web-server option.org.{turanokul}needs only one root and the PHP front controller, so it stays on the shared Nginx either way.
Process roles
| Role | Runs | Notes |
|---|---|---|
web
|
PHP-FPM replicas | Private, no published port. One group, N replicas of one release, no local persistent state |
worker
|
Horizon | Mounts the same release at the same path. Its own lifecycle and resources. Image adds Ghostscript, poppler-utils and libvips |
scheduler
|
Laravel scheduler | Single instance, same release mount |
reverb
|
Reverb | Release 2. Separate service, routed directly by Traefik, not part of the PHP-FPM runtime |
Release contract
TuranOrdo owns the deployment contract and the release lifecycle. TuranOkul builds and supplies releases and does not invent its own Nginx and PHP-FPM synchronization.
| Owner | Responsibilities |
|---|---|
| TuranOkul | Source code, Composer dependencies, frontend builds, build scripts, artifact contents, application migrations |
| TuranOrdo | Release storage, versioning, permissions, read-only mounts, runtime attachment, coordinated activation, health verification, rollback |
-
Three independent artifacts:
turanokul(the Laravel release: app, vendor, bootstrap,public/with the admin Vite build, and precompiled route, view and event caches),student-shell(Student App build) andstudent-study(Study App build). Each has its own version. -
Immutable versioned directories on a shared host volume for the first implementation
(OCI-based artifacts can come later). The release is mounted read-only at the same absolute path in every
consumer, so
SCRIPT_FILENAMEresolves identically. The gateway mounts onlypublic/of the Laravel release, and the PHP-FPM, worker, scheduler and (later) Reverb roles mount all of it. -
Coordinated activation. No in-place
currentsymlink flip, which could leave the gateway serving release A while PHP-FPM runs release B. TuranOrdo attaches the new release to new replicas and the gateway in one controlled sequence, verifies health, drains the old replicas, and keeps the previous release for rollback. - Static retention. Each static artifact includes the hashed files of the previous N releases, merged in by TuranOkul’s build, so pages and exams open at activation time and rollbacks keep working. Start with enough releases to cover the longest exam duration plus two. Deploys are frozen during scheduled exams.
- Backend first. The backend deploys before the apps, and API changes stay backward compatible for one release.
- One node. A shared host volume fits the one-node MVP. Multi-node operation needs another distribution mechanism.
Laravel on a read-only release
-
The PHP image holds only PHP, extensions and configuration. Code comes from the mounted release, and
opcachetimestamp validation can stay off, because a release path never changes. -
Laravel writes only to ephemeral paths.
storage/is redirected, sessions live in Redis, logs go to stdout, and views are precompiled into the artifact. - The config, services and packages caches are generated at container start into an ephemeral
path, set through the
APP_*_CACHEvariables, because configuration caching bakes in environment values and secrets arrive at runtime. Route and event caches are built into the artifact.
Gateway route model
A host is a set of ordered routes, not one document root and one PHP entry point. Precedence must be preserved in the generated configuration.
| Route property | Purpose |
|---|---|
match
|
URI prefix, exact path or controlled pattern |
handler
|
static, php or proxy
|
root
|
Static or application document root. Prefer root over alias, with a directory layout that mirrors the URL prefix
|
fallback
|
SPA fallback such as /index.html
|
fastcgi_target
|
Private PHP-FPM service endpoint |
script
|
The PHP front controller. Only this script executes, and there is no pattern handler for arbitrary
.php files
|
Illustrative configuration for the student host (not deployable as written):
server {
server_name student.{turanokul};
location ^~ /api/ { include turanokul-php.conf; }
location ^~ /sanctum/ { include turanokul-php.conf; }
# Study App: directory layout contains study/index.html and study/assets/
location ^~ /study/ {
root /releases/student-study/current;
try_files $uri /study/index.html;
}
# Student App
location / {
root /releases/student-shell/current;
try_files $uri /index.html;
}
}
# turanokul-php.conf
include fastcgi_params;
fastcgi_pass turanokul-fpm; # private endpoint managed by TuranOrdo
fastcgi_param SCRIPT_FILENAME /releases/turanokul/current/public/index.php;
fastcgi_param DOCUMENT_ROOT /releases/turanokul/current/public;
fastcgi_read_timeout 60s;
Here current is the mount point of the active release, set by TuranOrdo’s coordinated activation,
not a symlink changed in place. Also required: forwarded host, scheme and client IP for Laravel’s trusted
proxies; a request body limit suited to API requests and small imports (large files go directly to MinIO);
per-route security headers (the Study App has its own content-security policy); long cache headers for hashed
files and short ones for index.html; and liveness and readiness routes. Release 2 adds a
/broadcasting/ route to PHP-FPM.
Deployment flow (assumed)
-
CI builds the
turanokul,student-shellandstudent-studyartifacts (and a new PHP image only when the runtime changes) and runs the tests. - Request infrastructure once.
- TuranOrdo stages the artifacts, runs the migration job once (expand/contract changes), attaches the release to new replicas and the gateway, activates with health verification, and rolls back on failure.
- Smoke-test the login, start-attempt and submit flows.
Object storage (MinIO)
- TuranOkul accesses MinIO through Laravel’s S3 disk with path-style addressing and least-privilege credentials per environment. A private bucket holds booklet PDFs, page images and imports. A public bucket is used only if admin assets are published there.
- Browser access: presigned PUT and GET URLs signed for the browser-reachable host, with CORS rules for the org and student origins. A URL signed for an internal host does not work in a browser, so the signing host must match the serving host. A separate internal endpoint can serve server-side calls.
- Durability: original PDFs and answer keys cannot be regenerated, so bucket versioning or backup is required. Page images can be regenerated.
- Portability: TuranOkul depends only on the S3 features it uses (presigned URLs, multipart upload, CORS, bucket policy), so the backend can be replaced. Local development uses MinIO or another S3-compatible container.
- Status: confirm the MinIO edition and patch policy (section 18).
PHP image, tuning and worker hardening
-
Plan for
pdo_pgsql,redis(phpredis),pcntlandposix(Horizon needs both),intl,bcmath,opcache,sodiumandzip. Pin PHP and extension versions. -
Set
pm.max_childrenfrom the container’s memory budget and measured per-worker memory, withpm.max_requeststo contain leaks. Turn off opcache timestamp validation, since a release path never changes. Use different INI values for web and worker roles. - One FPM group serves the admin panel and the student API until load tests show admin or report load hurting student latency.
- The worker image processes user-uploaded PDFs, so it runs as a non-root user with CPU, memory and time limits, a read-only root filesystem, and egress limited to MinIO, Redis and PostgreSQL where the platform allows. Call Ghostscript and poppler directly, because ImageMagick’s default policy often blocks PDFs.
Infrastructure requests
TuranOkul requests a PostgreSQL database and roles (including the insert-only audit role and the retention role), a Redis instance and MinIO buckets with credentials from TuranOrdo through its resource mechanism, and receives secrets from the platform. Development, tests and production use the same interfaces, so CI runs against real PostgreSQL and Redis.
Questions to confirm with TuranOrdo
-
Whether the shared Nginx registry supports the ordered route model above. If not, the dedicated Nginx
container for
student.{turanokul}applies. - The release lifecycle: immutable versioned directories, read-only mounts at the same path for the gateway and several PHP roles, coordinated activation, rollback, and retention of previous releases.
-
How non-FPM roles (Horizon, scheduler, later Reverb) are declared, and whether a non-PHP service can be
registered with Traefik for
ws.{turanokul}. - Who runs migrations, and how health and readiness routes are used.
-
The PostgreSQL version and the availability of
ltree,pg_trgm,unaccentand ICU collations, plus backups and point-in-time recovery. Redis persistence, replication and failover. - MinIO: edition and patch policy, exposure to browsers through Traefik, CORS and presigned-URL behavior, and versioning or backups.
16. Observability, testing and quality
Observability
- Horizon for queues, structured logs with correlation IDs, and an error tracker (to be selected).
- Per-route metrics: latency, errors and rate-limit hits.
- A small set of alerts: queue depth and latency (especially
scoring), failed jobs, Redis memory, FPM worker saturation, disk space, and audit table and partition growth. - Telescope is useful in development and staging, but it records request and query details. Restrict or disable it in production.
Testing
- Pest for unit, feature and contract tests. Most tests target actions, services and policies once. Adapter tests are thin contract tests.
- Architecture tests that enforce the layering in section 4.2, and consistency checks for the operation registry and the OpenAPI spec (section 7).
- Policy tests for every permission-guarded action, audience-isolation tests (a student session against staff operations and the reverse), and tenancy-leak tests for every query path.
- Audit tests: every audited operation writes exactly one event in the same transaction, and a rolled-back change leaves no audit row.
- Playwright smoke flows: sign in, take an exam, see the result, and the deep link from the Student App to the Study App.
- One load test of the exam peak at the pilot profile (section 20) before the pilot.
- A backup restore rehearsal for PostgreSQL and Redis before the pilot.
- A release activation and rollback rehearsal before the pilot, including an exam in progress during the switch.
17. Delivery plan
These are rough estimates for a team of about three engineers. They are assumptions, not measured figures, and should be revised after Phase 0. The aim is a pilot-ready MVP, then the later releases.
Release 1 (MVP)
| Phase | Content | Rough duration |
|---|---|---|
| 0 |
Spikes and decisions: Sanctum with one guard per host, PDF-to-image pipeline, entitlement approach
(recursive CTE vs ltree vs closure table), OpenAPI generation and client codegen, the
release-artifact and virtual host arrangement with TuranOrdo, MinIO buckets with CORS and presigned
URLs, TuranOrdo confirmations (section 15)
|
2–3 weeks |
| 1 | Foundation: monorepo skeleton, CI and release build scripts, tenancy, staff and student accounts and guards, sessions, RBAC, shared domain layer and operation bus, audit | 4–5 weeks |
| 2 | Organization and library admin: institutions, branches, classes, students and Excel import, gains and contents, media upload, PDF conversion | 4–6 weeks |
| 3 | Exam booklets: region editor island, items and answer key, publishing | 5–7 weeks |
| 4 | Packages and entitlement, Study App, thin Student App, scoring, results and per-gain statistics | 5–7 weeks |
| 5 | Hardening and pilot: load test, security review, backup restore and release rollback rehearsals, email, TOTP for platform staff, onboarding the first institution | 3–4 weeks |
The phases sum to roughly 23–32 weeks. Allowing for overlap and for the uncertainty in the PDF pipeline and the region editor, a pilot-ready MVP is about 6–8 months of work for three engineers. A thin vertical slice (one booklet through attempt, scoring and result) should run by the end of Phase 2 and drive the remaining phases.
Later releases (very rough)
- Release 2: Parent App, homework, live-lesson scheduling, question booklets, hotspots, annotation, study plans, gap lists, package enhancements, Reverb and notifications, TOTP for all staff. Roughly 5–7 months.
- Release 3: optical forms and DAT import, online payments, CDN and scale hardening, and GraphQL or integrations if needed. Roughly 3–5 months.
18. Risks and open decisions
- Scope creep. The biggest risk for a small team. Mitigations: the MVP boundary in section 2, the vertical slice first, and the later-release list as the place deferred ideas go.
- Sanctum with one guard per host. Selecting the guard and audience by host is not the stock Sanctum setup. It is a modest customization and a Phase 0 spike. A fallback is explicit session guards with host-based middleware.
- Shared-layer discipline. Business logic creeping into controllers or Blade views would bring back the drift the shared layer prevents. Mitigations: architecture tests in CI, the generator that makes the correct path the easy one, and code review.
- OpenAPI generation and client tooling. Generation from code can be inaccurate. A fallback is a hand-maintained spec or a small hand-typed client for the MVP’s few endpoints.
-
Entitlement performance. Computing access through content hierarchies across packages can
become slow. Options are recursive CTEs,
ltree, a closure table, cached granted-content sets, or a combination. This needs a Phase 0 spike. - PDF and page-image pipeline. Scanned PDFs, very large files and unusual fonts can break or slow conversion. Plan limits, timeouts, a retry and manual-fix path, and early tests with real institution PDFs.
- A planned platform runtime. The Containerized PHP runtime is a planned extension. The route model, the release lifecycle and non-PHP service registration are dependencies. The fallbacks are a dedicated Nginx for the student host, a single-node deployment, and deferring Reverb to Release 2.
- Release synchronization. The gateway and PHP-FPM must see the same release, and old hashed files must outlive activation. A mismatch causes 404s or wrong code paths, most painfully during exams. Mitigations: TuranOrdo-owned coordinated activation, previous assets retained in the static artifacts, a deploy freeze during scheduled exams, and a rollback rehearsal before the pilot.
-
One Redis instance. Queues, sessions and cache share one instance with
noeviction. Cache TTLs and the memory alert keep this safe, and the split trigger in section 20 applies. Persistence and failover depend on TuranOrdo. - PostgreSQL as the single stateful store. Data, audit and tenancy all depend on one database. Backups, point-in-time recovery and failover are first-class concerns, and ownership must be agreed with TuranOrdo.
- Object storage backend. MinIO’s upstream community edition has reportedly been archived and no longer receives security fixes (to verify). Confirm which edition TuranOrdo runs and how it is patched, and decide on a maintained backend (a supported MinIO edition or an S3-compatible alternative). Original PDFs and answer keys need versioning or backup, and presigned URLs, CORS and multipart upload must be tested on whichever backend is chosen.
- Exam-day load and image delivery. The pilot is small, but a CDN is needed before exam events at larger scale, because origin storage delivery would saturate bandwidth (section 20).
- Tenancy model. Shared database with scoping is cheapest and simplest. Row-Level Security, schema-per-tenant or database-per-institution may be needed if large clients demand stronger isolation or data residency guarantees.
- Monorepo with two toolchains. CI must run only the affected parts, and repository access is coarse. Code owners, path filters and build caching are the mitigations, and the split path in section 4.3 applies if the team or vendors grow.
- Stateless is a discipline, not a setting. One local-disk write or file-based cache anywhere breaks replica interchangeability. The checklist in section 11 is enforced in code review and by running two replicas in tests.
- Later-release uncertainty. Optical form reading (scan quality, form variety) and online payments are the least certain features. They are Release 3, with accuracy targets and a manual-correction path to be defined then.
19. Assumptions to confirm
- The team is about three engineers, who work on both the backend and the client apps.
- TuranOrdo’s Traefik is the edge router. A web gateway, either the shared Nginx or a dedicated one for the student host, fronts TuranOkul’s private PHP-FPM replicas (section 15).
- TuranOrdo owns the release lifecycle and TuranOkul owns builds and artifact contents.
- The MVP runs on one node and the first release implementation uses a versioned release directory on a shared host volume, which implies a single node. Multi-node operation follows TuranOrdo’s capabilities.
-
Reverb, when added, is a separate service routed by Traefik on
ws.{turanokul}. - Object storage is TuranOrdo’s MinIO, reachable from browsers for presigned URLs. A CDN is added before large exam events.
- Live video is provided by an external platform; TuranOkul only schedules, enrols and links (Release 2).
- Payments are handled through an external provider (Release 3), with TuranOkul owning orders, invoices and access.
- Feature scope broadly mirrors an existing mature LMS in this domain. The MVP and the release split in section 2 are trimmed accordingly.
- Interface languages and localization needs (for example Turkish and English) are not yet defined.
-
The base domain is not yet registered.
{turanokul}stands for it throughout, and the hostname plan assumes the hosts share one registrable domain. - The marketing website is a separate project, outside these repositories.
-
The Study App is served at
student.{turanokul}/study/and shares the student session with the Student App. - The API is REST. GraphQL and service credentials are added only if a need appears (section 7).
- Staff accounts are global with roles per institution. Students belong to one institution, with identifiers configurable per institution. Guardians arrive in Release 2.
- The backend, the client apps and the shared packages live in one repository with two toolchains.
- Audit volume, once scoped as described in section 10.2, is small enough for the primary PostgreSQL database. This needs a Phase 0 estimate.
- The pilot and growth profiles in section 20 are planning assumptions, not measurements. The timeline in section 17 is an estimate.
20. Capacity profile, sizing and triggers
All figures below are planning assumptions. They size the first environment and define load-test targets, and they should be replaced with measured numbers as soon as real traffic is known.
Pilot profile (MVP)
| Dimension | Planning figure |
|---|---|
| Institutions / branches | 3 / 10 |
| Registered accounts | 3,000 students, 150 staff |
| Daily active students | about 900 (30%) |
| Evening peak, concurrent sessions | about 300 students, 30 staff |
| Exam-event peak | 500 concurrent in-progress attempts; 500 starts within 3 minutes; 500 submissions within 2 minutes |
| Autosave cadence | one batch per attempt about every 15 seconds, with jitter |
| Attempts and answers | about 10,000 attempts per month, about 1.2 million answer rows per month, about 14 million per year |
| Exam media | booklets of about 200 pages at roughly 100–200 KB per page image |
Derived load at the pilot
- Autosave at the peak: about 33 requests per second. Starts: about 3 per second. Submissions: about 4 per second.
- Mixed API load: about 100 requests per second sustained, with bursts to about 200 per second, including result polling.
- Image delivery: if 500 students open the first ten pages of a booklet within a few minutes, that is on the order of 750 MB, which direct storage delivery handles at this scale.
Starting sizing for the pilot (to validate by load test)
| Component | Starting point |
|---|---|
web
|
2 PHP-FPM replicas × 16 children behind the web gateway |
worker
|
1 container; about 4 scoring, 2 files and 3 other processes
|
scheduler
|
1 |
| Static apps | Served by the web gateway from the static release artifacts (no containers) |
| PostgreSQL | Provided by TuranOrdo; reference 4 vCPU, 16 GB RAM, fast SSD |
| Redis |
One instance, about 1 GB, noeviction, AOF
|
| Object storage | TuranOrdo’s MinIO; CDN not required yet |
The web sizing assumes an average request time of about 100 ms, which gives 32 FPM workers a theoretical ceiling near 320 requests per second against a burst of about 200. That is workable headroom, but the 100 ms figure must be measured.
Triggers for adding deferred components
| Component | Add when |
|---|---|
More web replicas | Busy FPM workers above 70% for five minutes |
| More scoring workers | scoring queue wait above 60 seconds at the 95th percentile |
| PgBouncer | PostgreSQL connections above about 70% of the limit |
| Second Redis instance | Cache memory or churn threatens queues and sessions, or Redis memory stays above 70% |
| Second FPM group | Load tests show admin or report load hurting student latency |
| Reverb | A requirement for instant notifications or progress streaming, or noticeable polling load |
| CDN | Exam events beyond the pilot scale, or storage egress limits or costs |
| Read replica | Reporting queries slow the primary |
| Multi-node replicas | Single-node CPU or memory saturation, or an availability requirement |
| GraphQL | The conditions in section 7 |
Growth target (planning reference)
The earlier medium profile remains the growth target: about 30 institutions and 100 branches, 30,000 students,
20,000 guardians and 1,500 staff, an exam-event peak of 3,000 concurrent attempts (about 200 autosave requests
per second, bursts to about 1,000 requests per second), about 4,000 realtime connections, and about 150 million
answer rows per year. Reaching it means more web replicas (about 4–6 with 24 FPM children each),
a split Redis, PgBouncer, Reverb with the event-loop extension, a CDN for exam page images (about 4.5 GB within
minutes at the peak), multi-node operation, and a second FPM group.
21. Decision log
| Decision | Chosen | Replaced or rejected | Reason |
|---|---|---|---|
| Scope | MVP first (thin slice, pilot-ready), then Releases 2 and 3 | Full scope in one release | Small team; earlier feedback on real exams; fewer unknowns at once |
| API style | REST first with OpenAPI and a generated client | GraphQL first; full dual-surface parity | Fewer moving parts for a small team building both sides; HTTP caching and per-route limits. GraphQL can be added as an adapter (one schema with audience guards, persisted queries at launch hardening) if the conditions in section 7 appear |
| API origin |
Same-origin /api per app host with stock Sanctum
|
A central API host | No CORS, preflights, custom CSRF flow or origin-to-audience mapping. Single base URL is not needed for first-party apps |
| Study App placement |
Independent app at student.{turanokul}/study/
|
A study. host; a module inside the Student App
|
Keeps one student session without cross-subdomain cookies, and keeps the app separately built, released and service-worked |
| Runtime | TuranOrdo Containerized PHP runtime: Traefik → web gateway → TuranOkul’s PHP-FPM replicas | TuranOkul-owned nginx and PHP-FPM images behind Traefik | Matches the platform’s preferred model. TuranOrdo owns the gateway and replica integration |
| Static apps |
Separate static artifacts (student-shell, student-study) with previous
hashed files retained
|
Separate nginx containers per app; the Study App inside the Student bundle | Independent versions and rollbacks, and open exams keep working after activation |
| Gateway |
Shared Nginx only if its registry supports ordered per-host routes; otherwise a dedicated Nginx
for student.{turanokul}
|
Assuming the shared Nginx supports it | One host needs several roots, SPA fallbacks and FastCGI rules, which is unverified until the registry is inspected |
| Releases | TuranOrdo-managed immutable versioned artifacts, mounted read-only at the same path, with coordinated activation | Application-invented gateway and PHP-FPM synchronization; in-place symlink flips | One contract for all PHP applications, and no serving of release A static files with release B code |
| Code delivery | PHP image holds the runtime; code comes from the mounted release | Code baked into the image | The gateway and PHP-FPM see the same files, and releases need no image rebuild |
| Reverb routing |
Independent service routed directly by Traefik, dedicated ws. host preferred
|
Through Nginx or PHP-FPM | WebSockets are HTTP Upgrade traffic, so no FastCGI layer is needed |
| Web container | FPM-only image, one group | nginx and PHP-FPM in one image; two FPM groups | Smaller image; the web server is the platform’s. A second group only if load tests justify it |
| Object storage | TuranOrdo’s MinIO through the S3 API, presigned URLs for browsers | An external S3 service | Provided by the platform. Backend status to be confirmed, and the S3-only dependency keeps it replaceable |
| Realtime | Polling in the MVP, Reverb in Release 2 | Reverb in the MVP | One less process, extension and client library; polling is enough for score and status delivery |
| Redis |
One instance with noeviction and TTL discipline
|
Two instances from day one | Small cache footprint; split trigger defined |
| Connection pooling | No PgBouncer until the connection trigger | PgBouncer from day one | Avoids pooling-mode pitfalls until needed |
| Repository | One monorepo: backend, client apps, shared packages | Two repositories |
One small team, shared exam-viewer between the admin island and the Study App, API
and clients change together. Split triggers are listed in section 4.3
|
| Marketing website | A separate project, outside the repositories | A Next.js app in the monorepo | Different cadence and contributors, and no dependency on the apps or API |
| Parent App | Release 2 | MVP | The pilot centers on students and staff; guardians need consent flows and links |
| Business logic | Shared domain layer (actions, services, policies, queries) behind one operation bus | Logic in controllers per surface | No drift between the admin panel and the API; one authorization path; faster development with generators; enforced by architecture tests |
| Accounts |
Separate tables and guards per audience (staff_users, students, later
guardians)
|
One users table with roles
|
Guard-level separation, per-audience policies, no RBAC for students |
| Authentication | Sessions with Sanctum stateful SPA mode | Passport/OAuth 2.0; JWT | All clients are first-party. Revocation is session deletion and a status check |
| Audit store | PostgreSQL | MongoDB | One database type; audit commits with the change; no outbox needed |
| Admin UI | Blade + Alpine, one React island for the region editor | Alpine only; full React/Inertia | The region editor shares code with the Study App without rewriting CRUD screens |
| Exam page images | Signed URLs from object storage; CDN when needed | Streaming through nginx | Keeps bandwidth off the web containers |
22. Sponsorship, validation and future development
TuranOkul is currently a proposal-stage project. No implementation exists yet, and it is not offered as an investment vehicle or securities offering. The Turan names are product and technology brands, not separate legal entities. Any future company-level investment follows the structure described in the TuranUlak documentation.
Contact: Institutions interested in acting as a sponsor or design partner can reach out through the contact page or at [email protected]. A short Turkish sponsor brief is available on request.
Two purposes
- Platform validation. TuranOkul is the first real PHP system on TuranOrdo’s planned Containerized PHP runtime: the gateway route model, the release lifecycle, read-only releases and non-FPM roles (section 15). This is an engineering goal and can be pursued without an external sponsor.
- Product validation. A learning management system that works for real exams, teachers and students. This needs a real institution as context, and it is the reason a sponsor is needed.
Sponsor and design partner
The sponsor is a Turkish school, a group of schools or another education institution. It is a design partner with a contribution, not an equity investor.
- What the sponsor provides: real requirements and workflows (exams, booklets, curriculum mapping); sample material it is permitted to share (exam PDFs, answer keys) for the PDF pipeline; pilot users (teachers and students) and a pilot period aligned with the school calendar; a named internal owner; funding or an equivalent in-kind contribution, for example a paid pilot or co-funded development; and feedback.
- What the sponsor can expect: early access, a voice in the MVP backlog within the scope in section 2, agreed pilot terms and support during the pilot. These terms are to be agreed in writing.
- What the agreement must settle: the legal counterparty on the TuranOkul side; ownership of the software and of the institution’s content and data; a data-processing arrangement under KVKK (the institution is likely to be the data controller, to be confirmed with counsel); pricing after the pilot; and no exclusivity or equity control tied to the pilot.
Stages and gates
| Stage | Content | Funding | Gate to the next stage |
|---|---|---|---|
| 0. Platform validation | Phase 0 spikes and the TuranOrdo confirmations in section 15, sample material for the PDF pipeline, sponsor conversations | Founder resources | The runtime capabilities are confirmed or their fallbacks accepted, and a candidate sponsor is identified |
| 1. Sponsor agreement | A written pilot agreement covering scope, data processing, ownership, the pilot window and the contribution | Founder resources | Agreement signed and permitted sample material received |
| 2. MVP build and pilot | Release 1 (section 17), pilot with the sponsor | Sponsor contribution and founder resources | The pilot meets the success criteria agreed with the sponsor |
| 3. Later releases | Release 2 and 3, additional institutions | Pilot and license revenue, more sponsors, and possibly company-level investment as described in the TuranUlak documentation | Decided at that time with legal, tax and corporate advisors |
Timing: schools typically start the year in September, and the MVP estimate is 6–8 months. A pilot at the start of the 2027–28 school year would therefore need the build to start around early 2027. This is arithmetic on an estimate, not a commitment. A pilot during an exam period or mid-year switch is riskier than one at the start of a term.
Pilot success criteria (to be agreed)
The sponsor and TuranOkul agree on a few measurable criteria before the pilot starts. Examples, with numbers to be set together:
- A target number of real exams run end to end with the institution’s own booklets.
- Results available within an agreed time after submission at pilot scale.
- No lost answers in a rehearsed connectivity-failure scenario.
- Teachers can create and publish a booklet without developer help.
- Agreed thresholds for open defects and for teacher and student feedback.
Sponsor criteria and risks
- Good fit: willing to run a pilot on real exams, to share permitted material, to name an internal owner, and to accept the MVP boundary.
- Concentration risk: one institution can pull the scope toward its own habits. Mitigations: the MVP boundary in section 2, a documented backlog process, and a second pilot institution later.
- Regulatory and procurement requirements for schools and education institutions, including any education-authority rules, are not covered here and must be checked with qualified advisors.
- Runtime dependency: the sponsor’s pilot depends on TuranOrdo’s planned runtime. The fallbacks in section 18 (a dedicated Nginx and a single node) are part of the risk disclosure to the sponsor.
Important notice
This section describes a potential sponsorship and development model only. It does not constitute an offer, solicitation, recommendation or invitation to purchase securities, shares, tokens or other financial instruments, and no investment is being solicited. TuranOkul is at proposal stage, and the capabilities described in this documentation are design intentions that have not been demonstrated. Any future financing would be offered only through an appropriately established legal entity and in accordance with the applicable laws and regulations.