MCPSERV.CLUB
Habitica

Habitica

Self-Hosted

Gamify your habits and tasks

Active(99)
13.4kstars
0views
Updated 1 day ago

Overview

Discover what makes Habitica powerful

Habitica is an open‑source, gamified habit‑building platform that runs as a full stack web service. At its core it exposes RESTful endpoints for managing users, tasks, parties, and in‑game items while simultaneously delivering a real‑time front end that updates HP, XP, and currency as users tick off or fail habits. The application is designed for extensibility: developers can write plugins, webhooks, and custom integrations that hook into the core event system without touching the base codebase.

Backend

Frontend

Database

Testing

Overview

Habitica is an open‑source, gamified habit‑building platform that runs as a full stack web service. At its core it exposes RESTful endpoints for managing users, tasks, parties, and in‑game items while simultaneously delivering a real‑time front end that updates HP, XP, and currency as users tick off or fail habits. The application is designed for extensibility: developers can write plugins, webhooks, and custom integrations that hook into the core event system without touching the base codebase.

Technical Stack & Architecture

  • Backend – Node.js (Express) with a modular middleware architecture. The server uses mongoose to interact with a MongoDB database, leveraging schema‑level validation and pre/post hooks for business logic. Real‑time features are powered by Socket.io, enabling instant UI updates across all connected clients.
  • Frontend – Vue.js (v2) with Vuex for state management. The SPA communicates with the backend via a well‑documented JSON API and WebSocket events, allowing developers to build custom dashboards or mobile wrappers that consume the same data streams.
  • Database – MongoDB (either a local instance or a managed cluster). Collections are heavily denormalized to reduce joins, which is typical for document stores but requires careful indexing; the repository includes a db/ folder with sample seed scripts and indexes.
  • Testing – Jest for unit tests, SuperTest for API integration tests, and Cypress for end‑to‑end scenarios. The CI pipeline (GitHub Actions) runs the full test suite on every push, ensuring that new contributions don’t break existing behavior.

Core Capabilities & APIs

  • RESTful CRUD – Endpoints for users, tasks (habit/goal/daily), groups, guilds, and items. Each resource follows a predictable URL scheme (/api/v1/users/:id, /api/v1/tasks/:id) and supports standard HTTP verbs.
  • Webhooks & Event Bus – Developers can register webhook URLs that receive JSON payloads for events such as task.completed, party.joined, or user.levelup. Internally, the app uses an event emitter pattern that can be extended via plugins.
  • Plugin System – The /plugins/ directory hosts modular extensions that hook into lifecycle events. Plugins are published as npm packages and can be loaded via a simple configuration file, allowing teams to add custom rewards or integrations without forking the core repo.
  • OAuth & Social Auth – The API supports OAuth2 for third‑party authentication (Google, Discord) and can be extended to support additional providers through the existing auth middleware.

Deployment & Infrastructure

Habitica is designed for containerized deployment. The repository ships with a docker-compose.yml that orchestrates:

  1. MongoDB – Persistent data store.
  2. Redis – Optional caching layer and Socket.io message broker for horizontal scaling.
  3. Habitica Service – Node.js container exposing the API and WebSocket server.

For production, a Kubernetes deployment is recommended: expose the service via an Ingress controller, use StatefulSets for MongoDB, and leverage Helm charts (available in the repo’s charts/ directory) to manage configuration. The architecture scales horizontally by adding more API instances behind a load balancer; Socket.io sessions are sticky or proxied through Redis to maintain real‑time consistency.

Integration & Extensibility

  • Custom Widgets – Since the frontend is a Vue SPA, developers can fork or clone the client/ repo and build custom dashboards that consume the public API.
  • Mobile Apps – Dedicated repositories for Android (React Native) and iOS (Swift) expose the same API endpoints, enabling native clients that share logic with the web app.
  • Third‑Party Tools – The API Usage Guidelines document outlines rate limits, authentication best practices, and data ownership rules. This ensures that external tools (e.g., productivity dashboards, analytics services) can integrate without compromising user privacy or server performance.

Developer Experience

The project’s documentation is comprehensive: the Wiki covers “Guidance for Blacksmiths” (architecture overview), local development setup, contribution guidelines, and API usage. Issue templates enforce consistent reporting, while the “Help Wanted” label surfaces low‑complexity tasks for newcomers. The community is active on GitHub Discussions and Discord, providing rapid feedback loops. Licensing under a permissive open‑source license allows commercial use without royalties.

Use Cases

  • Team Productivity Platforms – Embed Habitica’s gamified task system into an internal portal to boost employee engagement.
  • Educational Tools – Schools can deploy a self‑hosted instance to reward students for completing assignments, leveraging the plugin system for custom badges.
  • Health & Wellness Apps – Combine Habitica’s habit tracking with wearable data via webhooks to create personalized coaching experiences.
  • Open‑Source Projects – Use Habitica’s API to gamify issue resolution, turning bug fixes into quests for contributors.

Advantages

  • Full Control – Self‑hosting removes dependency on external services, giving teams full visibility into data and the ability to audit code.
  • Performance & Flexibility – Node.js + MongoDB offers low latency for CRUD operations, while the plugin architecture lets developers extend behavior without core modifications.
  • Community & Longevity – An active contributor base and mature CI pipeline reduce technical debt, ensuring that the platform remains secure and up‑to‑date.
  • Cross‑Platform Reach – Native mobile clients and a responsive web UI mean developers can reach users on any device

Open SourceReady to get started?

Join the community and start self-hosting Habitica today

Weekly Views

Loading...
Support Us
Most Popular

Infrastructure Supporter

$5/month

Keep our servers running and help us maintain the best directory for developers

Repository Health

Loading health data...

Information

Category
other
License
NOASSERTION
Stars
13.4k
Technical Specs
Pricing
Open Source
Database
MongoDB
Docker
Community
Supported OS
LinuxDocker
Author
HabitRPG
HabitRPG
Last Updated
1 day ago