lottie
The editor and its projects
JSON v1 document, optimistic revision, private resources, animation import and export.
ProjectService · DocumentValidatorFrom first startup to your next feature. Understand how the Lottie editor, identity and catalogues fit into one solution.
START HERE
Four stops from the repository to a saved edit.
Java 21, Node ≥ 22.13, pnpm 11.25.0, Docker and an available MySQL instance. Maven runs with
./mvnw.
Create a dedicated database and application account. Flyway creates the tables; Hibernate validates the schema.
Understand the tablesStart Compose, sign in with the initial administrator and change the temporary password before continuing.
Understand accessCreate a project, import a resource and edit it. Saving uses revisions to detect concurrent changes.
Follow an editThree business modules live within one monolith. They share a process, database and storage, while keeping their models and ports separate.
FROM THE REPOSITORY TO THE STUDIO
Choose an environment. Each path uses configuration already present in the repository.
Compose starts frontend, monolith and mailpit. MySQL must already exist; no database container is created.
.env with 0600 permissions and refuses to overwrite it.
DB_USER,
DB_PASSWORD and the dedicated schema in
DB_NAME. Check host and port.
pnpm install --frozen-lockfile
pnpm setup:local dev@example.com
# Completa tu .env antes de arrancar.
docker compose up -d --build
http://localhost:18089Development emailhttp://localhost:18026
In Docker Desktop,
host.docker.internal:3306
points to the host.
localhost inside the container points to that container itself.
For local HTTP:
COOKIE_SECURE=false and
PUBLIC_URL=http://localhost:18089. The initialiser already suggests these values.
Traefik terminates TLS. Caddy serves the SPA on internal port 80 and proxies the API to the monolith on 8080. This Compose file publishes no host ports.
main and Compose Path
./compose.dokploy.yaml. Keep Isolated Deployments disabled for this configuration.
DB_NETWORK must be an existing network shared with MySQL; by default,
dokploy-network.
JWT_SECRET and
INSTALLATION_ID between deployments.
lottiej.acode.es, path
/, service
frontend, port
80, HTTPS and Let's Encrypt.
Do not add a separate backend domain. A shared origin keeps cookies and CSRF consistent.
Read the full Dokploy guide
Do not combine the two Compose files. Keep the same service/project and volume
mono-files. Update images without running
docker compose down -v.
The A record must point to the VPS. If an AAAA record exists, it must also resolve to a server serving the application. MySQL needs no Internet exposure.
Flyway applies migrations and Spring validates the schema. The initial administrator is created only when no users exist; changing initial variables does not edit an existing account.
Export connection variables yourself for a dedicated schema in your MySQL instance. The backend also needs the JWT key, initial credentials and SMTP configuration.
DB_URL,
DB_USER and
DB_PASSWORD for your schema, with the UTC timezone.
JWT_SECRET,
INITIAL_ADMIN_EMAIL,
INITIAL_ADMIN_PASSWORD,
PUBLIC_URL and
COOKIE_SECURE=false
for local HTTP.
/api and
/public to
localhost:8080.
./mvnw spring-boot:run
pnpm --filter @modella/frontend dev
Use the URL printed by Vite. The backend listens on 8080.
| Group | Variables | Responsibility |
|---|---|---|
| Persistence |
DB_HOST · DB_PORT · DB_NAME ·
DB_USER · DB_PASSWORD
|
Compose constructs DB_URL; native execution sets DB_URL directly. Use a dedicated schema. |
| Identity |
JWT_SECRET ·
INITIAL_ADMIN_EMAIL ·
INITIAL_ADMIN_PASSWORD
|
HS256 signing with a Base64 key of at least 32 bytes, and initial account creation in empty installations. |
| Origin |
PUBLIC_URL · COOKIE_SECURE ·
INSTALLATION_ID
|
Recovery links, HTTPS cookies and a stable identity to separate drafts. |
SMTP_HOST · SMTP_PORT ·
SMTP_AUTH · SMTP_STARTTLS ·
SMTP_USERNAME · SMTP_PASSWORD ·
MAIL_FROM
|
Production requires real SMTP; Mailpit belongs only in the local environment. | |
| Files |
STORAGE_PATH · FONTS_PATH
|
In containers: files in
/data/files and bundled fonts in
/data/fonts.
|
BOUNDARIES THAT MAKE CHANGE EASIER
Rules stay inside; HTTP, SQL and files connect through adapters.
lottie
JSON v1 document, optimistic revision, private resources, animation import and export.
ProjectService · DocumentValidatorcatalog
Catalogues and items with metadata, files or external URLs, duplication and resource publishing.
CatalogService · CatalogRulesaccess
Users, local credentials, roles, permissions, auditing and protection of the last administrator.
AccessService · IdentityRulesProduction container and service view.
Models and invariants. No Spring or JPA.
Use cases and port contracts.
REST, persistence and storage.
Dependency wiring with Spring.
Selected real classes. See the generated reference for all members.
The domain validates; ports resolve data and files.
CatalogRules filters editable fields before persistence.
Administration is separated from credential and session details.
FOLLOW AN ACTION THROUGH THE SYSTEM
The interface preserves your work; the server decides which version can be committed.
The UPDATE atomically compares and increments the revision.
The revocable session, user status and current permissions are checked.
The deletion intent is committed in the same business transaction.
Both start at revision 7. Save from A, then from B: see why the server rejects the second write.
This example does not call the API or modify projects.
espera revisión 7
espera revisión 7
document.mjs manages layers, tracks and history. compiler.mjs converts to Lottie JSON. SVG, text, curves and packages have their own modules; the WASM player prefers WebGL and can fall back to Canvas.
dotLottie packages can preserve other animations, themes and state machines. Export protects their structural references; it does not transform the editor's v1 document format.
FROM FORM TO AUTHENTICATED SESSION
Spring Validator checks received data, BCrypt verifies the password and Spring Security validates the JWT and access on every request.
Validación
Spring MVC integrates Jakarta Validation through Spring Validator. @Valid activates DTO constraints before the controller method executes.
Autenticación
AuthAccounts looks up the local user, checks that the account is enabled and uses
PasswordEncoder.matches to compare the password with its BCrypt hash.
Sesión
The server signs a 30-minute JWT and delivers it in a cookie. Each protected request checks the token, persisted session and current privileges.
HS256 · auth_sessions · Spring Security
In AuthController, the JSON body is bound to Login with
@Valid @RequestBody. Annotations check presence, email format and length; they do not query the account or verify the password.
/csrf. It is also required for login.
ApiErrors transforms into Problem Details with status 422.
401 response.
authenticateAndOpen locks the user row and creates the SQL session in the same transaction, coordinating with password changes.
public record Login(
@NotBlank @Email @Size(max = 254)
String email,
@NotBlank @Size(max = 72)
String password
) {}
// Parámetro de entrada del método login:
// @Valid @RequestBody Login data
The policy for new passwords—12–72 printable ASCII characters—applies to account creation, changes and resets. The login DTO checks the limits shown here.
AuthController builds the claims and
NimbusJwtEncoder signs with HS256.
LocalSecurity configures the decoder and per-request checks.
| Claim / check | Value in Modella | Purpose |
|---|---|---|
iss and aud |
modella-mono and
modella-web
|
Identify the issuer and audience accepted by the decoder. |
sub |
Local user identifier. | Links the token to the enabled user and current assignments. |
jti |
Session UUID. |
Must exist in
auth_sessions, belong to the subject and remain valid.
|
iat and exp |
Issue and expiry times, 1800 seconds apart. | Limit JWT lifetime to 30 minutes, without silent renewal. |
| HS256 signature |
Key JWT_SECRET in Base64, at least 32 bytes long.
|
The decoder checks integrity and algorithm. Signing does not encrypt claims; the token contains no passwords. |
| Roles and permissions | Queried from the database on every request. | The JWT carries no copy of privileges. Disabling users or changing assignments takes effect on the next request. |
The cookie MODELLA_TOKEN uses
HttpOnly,
SameSite=Strict, path
/ and Secure in production. The JSON response contains
authenticated: true; the SPA neither receives the JWT in JSON nor stores it in localStorage. It then queries
GET /api/v1/session to load the user, permissions and
mustChangePassword.
Logout deletes the session row and removes the cookie. Changing or resetting a password invalidates all user sessions. Even a saved copy of an unexpired JWT is rejected when SQL detects a revoked session.
SessionCreationPolicy.STATELESS
avoids using a Spring Security HttpSession to preserve authentication between requests. Modella maintains
auth_sessions to check JWT validity and revocation. If
must_change is active, the server restricts business APIs until the temporary password is changed.
| Status | Origin | What the frontend displays or checks |
|---|---|---|
400 |
JSON that cannot be parsed or bound correctly. | Review the body and types sent to the API. |
422 |
DTO Jakarta Validation constraints. |
Display errors beside the form fields.
|
401 |
Incorrect credentials or, on protected routes, an invalid token/session. | Display the access error or request a new login. |
403 |
Invalid CSRF; on protected routes, permissions or an outstanding initial password change. | Check CSRF, session status and operation permissions. |
429 |
More than ten attempts in the persistent fifteen-minute window per IP or account. | Wait before retrying; rejection does not clear the counter. |
THE PERSISTENT STRUCTURE
14 tables declared in
V1__monolith.sql. JSON for editable content; explicit ownership and identity relationships.
Bytes live on disk; keys and metadata live in SQL.
Definitions are identified by the (name, permission) pair.
Four independent tables, without business foreign keys.
| Table | What it stores | Rule to remember |
|---|---|---|
lottie_projects |
JSON document, name, revision and date. | The expected revision protects saving. |
lottie_resources |
Private-file metadata and key. | Required project_id; cascading SQL deletion. |
catalogs |
Catalogue, public code, status and payload. | Stable unique_code; entity revision. |
catalog_elements |
Item, type, metadata and optional file. | Required catalog_id; the service removes children first. |
identity_users |
Profile, unique email, hash and status. | must_change blocks business operations until the password changes. |
identity_definitions
|
Local roles and permissions. | Composite PK: name + permission. |
identity_assignments
|
Roles and permissions assigned to users. | FK to user and definition; composite key prevents duplicates. |
identity_role_permissions
|
Permissions making up a role. | Composite FKs and CHECK distinguish roles from permissions. |
auth_sessions |
Active session identified by JWT ID. | FK to user and expiry; logout deletes the row. |
password_resets |
SHA-256 of the recovery token. | One link per user; single-use, 15 minutes. |
auth_attempts |
Counter and expiry per bucket. | Persistent windows shared across instances. |
identity_lock |
One coordination row, id = 1. | Transactional lock for administrative access. |
audit_entries |
Actor, action, resource and outcome. | Independent transaction; no credentials or bodies. |
pending_file_deletions
|
Key, attempts and pending-deletion date. | Unique file_key; delete the file first, then the task. |
Hibernate uses ddl-auto: validate. After deploying a version, add a new migration; do not edit V1 or an applied migration. Rolling back an image does not automatically revert the database.
OPERATE WITH CONTEXT
Controls live on the server. Interface states help explain them.
30-minute HS256 JWT in an HttpOnly, SameSite Strict cookie, Secure in production. The database checks session, status and privileges on every request.
BCrypt with cost 12. New passwords use 12–72 printable ASCII characters. Single-use 15-minute recovery, with only its SHA-256 persisted.
admin administers identity.
lottie-manage and
catalog-manage enable each area. The initial role editor includes both permissions.
The server checks content and format, sanitises SVG and limits ZIP files. Only catalogue files with current metadata are served publicly.
Distinguish transport, use-case and document limits.
Editor uploads are also limited to 60 per minute and identity per instance. A ZIP allows up to 1000 entries, 20 MiB per entry and 64 MiB uncompressed. The multipart request limit is 102 MiB.
/api/v1/csrf.
curl --silent --output /dev/null \
--write-out '%{http_code}\n' https://lottiej.acode.es/
curl --silent --output /dev/null \
--write-out '%{http_code}\n' https://lottiej.acode.es/api/v1/csrf
mono-files, within a consistent window.
INSTALLATION_ID; rotating JWT_SECRET invalidates issued tokens.
X-Request-Id; do not copy secrets or sensitive bodies into logs.
| Signal | What to check |
|---|---|
401 / 403 |
Valid session, Secure cookie/origin, CSRF header, current permissions and initial password change. |
409 when saving |
Another tab committed a different revision. Preserve the draft and resolve the conflict before reloading. |
422 |
Problem Details includes field errors: document structure, references, formats and limits. |
429 |
Attempt or upload limit. Check the window and Retry-After when returned. |
Unknown database / Access
denied
|
Schema existence, credentials and application-account permissions. |
Communications link
failure
|
Internal host, port, shared network and MySQL listening from Docker. |
| Recovery email does not arrive | SMTP configuration, TLS and delivery. The public response is uniform and does not reveal whether the account exists. |
Known limitations: no MFA or silent renewal. Recovery email is synchronous; a transactional outbox would be a future improvement, not a current feature.
YOUR NEXT CHANGE
Before adding infrastructure, locate the rule and its owning module.
backend/src/main/java/com/modella/
├── access/ # identidad local
├── catalog/ # catálogos y elementos
├── lottie/ # proyectos del editor
└── support/ # archivos, web y seguridad
backend/src/main/resources/
└── db/migration/ # esquema Flyway
frontend/src/
├── platform/ # API, navegación y UI
├── pages/ # panel y autenticación
└── lottie/
├── core/ # documento y compilación
└── components/ # controles y hooks
infra/ # imágenes y proxy
scripts/ # configuración y documentación
docs/html/ # este portal + referencias
Lottie_v1 intact, along with the editor's JSON v1 format. Do not commit
.env, backups or browser sessions.
| What to check | Command | Scope |
|---|---|---|
| Production frontend | pnpm build |
Vite build. |
| Editor engine | pnpm test |
Document and transformation unit tests. |
| Editor in the browser |
pnpm --filter @modella/frontend
test:e2e
|
Chromium with test transport. |
| Panel and access |
pnpm --filter @modella/frontend
test:platform
|
Flows with a mocked API. |
| Java domain and use cases | ./mvnw test |
Unit tests and architecture rules. |
| Java formatting | ./mvnw spotless:check |
Backend conventions. |
| SQL / HTTP integration |
./mvnw verify -Pintegration
|
Ephemeral MySQL through Testcontainers. |
| This portal | pnpm test:docs |
Static portal links and behaviour. |
| Regenerate references | pnpm docs:build |
Javadoc, JSDoc, diagrams and local sources. |
Use the Testcontainers integration profile to validate persistence. Do not export credentials from a user's database to run tests. Docker must be available to create ephemeral MySQL.
FROM OVERVIEW TO DETAIL
These references are included in local subfolders and can be read offline.
Packages, classes, ports, parameters and use-case contracts.
Open Javadocjavadoc/index.html FrontendComponents, hooks, editor modules and document types.
Open JSDocfrontend/index.html HTTP contractRoutes, bodies and responses for integration or server checks.
View OpenAPI JSONfuentes/openapi.json
From the root, run
pnpm docs:build after changing contracts or comments. SVGs are generated from scripts/docs-diagrams.mjs; update relationships when the model changes. This guide is a snapshot, not a deployment monitor.