Twake
⬅️ Go on twake
  • ☀️ Twake
  • Getting started
    • ▶️Use Twake on twake.app
    • 🏗️Install on your server
      • 🎡Scale with Twake
    • ⚙️Configuration
      • 🔒Security
      • 🔗Custom domain + HTTPS
        • Apache2 configuration
      • 💌Configure mail server
      • 🎨Customisation
      • 🔌Connectors and plugins
      • 👨‍💻 Authentication modes
        • Using Keycloak (LDAP, OpenID and more)
        • Installing Twake with LemonLDAP (LDAP, OpenID and more)
  • How to use it
    • 👋Welcome to Twake !
    • 🧰Console
      • Users
    • 🏢Company & workspace
      • Invite user from Chat
      • Rights
    • 💠Applications
      • 💬Chat
        • Channels
        • Message
      • 📂Drive
        • File and folder
        • Share file with public link
      • 📆Calendar
      • ✅Tasks
      • 🔃Connectors
        • n8n
    • 🖥️Desktop and mobile app
    • 🔒Privacy
  • Developers API
    • 🏠Home
    • 🥇Getting started
      • Create your first application
      • Authenticate with Postman
      • Send a message with your application
      • Trigger action from command
    • ⚙️Application settings
      • Api
      • Display
      • Privileges
      • Identity
    • 📖API Reference
      • Webhook
      • Drive
      • Message
        • DELETE Request
        • POST Request
      • Authentication
    • 🧱Blocks
  • Internal Documentation
    • 🥇Get started
    • 🎨Twake Ecosystem Guidelines
    • 📚Our stack
    • 🧱Backend and APIs
      • 🔑(WIP) Authentication
      • 👥Users and workspaces
      • 🍎Applications
        • Database models
        • REST APIs
      • 🎩Channels and tabs
        • Database models
      • 💬Messages
        • Database models
      • 📄Files
        • Database models
        • REST APIs
        • Resumable.js
      • 📲Notifications
        • Database models
      • 🛠️Twake service development
        • What is a service in Twake ?
        • Create a new service
        • Platform/Technical services
          • Database ORM platform service
    • 🖥️Web, desktop and mobile
      • Table
      • ObjectModal
        • ObjectModalTitle
        • ObjectModalSeparator
        • ObjectModalSectionTitle
        • ObjectModalFormTitle
      • UserListManager
      • MediumPopupManager
      • MenuManager
    • 🎭Translation
Powered by GitBook
On this page
  • Discover what is in a service
  • /web/controllers : where everything starts
  • /services : where the magic happen
  • /entities : where we keep the data

Was this helpful?

  1. Internal Documentation
  2. Backend and APIs
  3. Twake service development

What is a service in Twake ?

You want to add new routes in an existing service, for instance add a feature to our channel service ? You are in the right place !

The backend is developed using a software component approach in order to compose and adapt the platform based on needs and constraints. The current section describes this approach, and how to extend it by creating new components.

The platform has the following properties:

  • A platform is composed of multiple components

  • A component has an unique name in the platform

  • A component can provide a service

  • A component can consume services from other components

  • A component has a lifecycle composed of several states: ready, initialized, started, stopped

  • A component lifecycle changes when a lifecycle event is triggered by the platform: init, start, stop

  • By creating links between components (service producers and consumers), components lifecycles are also linked together: A component going from ready to initialized will wait for all its dependencies to be in initialized state. This is automatically handled by the platform.

The platform currently have some limitations:

  • Components can not have cyclic dependencies: if component X requires a component which requires component X directly or in one of its dependencies, the platform will not start

  • Components can only have local dependencies.

Discover what is in a service

To unfold the internal ways of services in Twake, we will follow a simple request journey into our framework.

  1. The requests starts from Twake Frontend or Postman for instance,

  2. it then goes to a controller which validate the request parameters and extract them for the services,

  3. the services uses the given parameters to get/set entities in database and returns a proper reply.

/web/controllers : where everything starts

This is where you declare the routing you want to use.

/services : where the magic happen

This is where you work for real, calling databases, sending websockets events, using tasks pushers etc.

/entities : where we keep the data

If you store data, you must define its data model and how it is stored in our database middleware.

This document is not finished, you can contribute to it on our Github.

PreviousTwake service developmentNextCreate a new service

Last updated 4 years ago

Was this helpful?

🧱
🛠️