Scheduled Tasks
NuxtBase includes maintenance tasks under server/tasks/*.
These tasks are part of the product’s operational layer. They are useful once the app is live, but they are not all-on by magic. You still need to wire them into your deployment or scheduler.
What Ships Today
Section titled “What Ships Today”demo:cleanup: removes stale demo business data older than 24 hoursai:reconcile: voids stale pending AI settlements and refunds reserved creditsbilling:repair-orphan-plans: repairs orphan Stripe billing plans by re-linking prices and subscriptions
Demo Cleanup
Section titled “Demo Cleanup”demo:cleanup is designed for public demo environments.
Important behavior:
- it only runs when
NUXT_PUBLIC_DEMO_MODE=true - it deletes business data older than 24 hours
- it does not target auth tables
- it removes dependent records in a safe order
The current cleanup task targets records such as:
- project data
- file assets and attachment refs
- AI conversations and messages
- AI usage ledger entries
- audit logs
AI Reconcile
Section titled “AI Reconcile”ai:reconcile exists to clean up stale pending AI settlements.
If a pending settlement sits around too long, the task:
- voids it
- refunds reserved credits back to the wallet
That keeps wallet balances from staying artificially reduced after interrupted or failed AI request flows.
Billing Repair
Section titled “Billing Repair”billing:repair-orphan-plans is an operational repair task.
It looks for billing plans that lost their canonical planKey, then tries to:
- resolve the right plan from known Stripe price IDs
- relink local billing prices
- relink local subscriptions
This is not a task most buyers run every day, but it is part of the shipped maintenance toolkit.
Operational Boundary
Section titled “Operational Boundary”The template gives you the task definitions, but not a production scheduler opinion.
In practice, you should decide:
- which tasks run in development only
- which tasks run in production
- how often they run
- where logs and alerts go when a task starts failing