ChatiumFor developersPlaygroundPricing
Sign in

What is Chatium


Chatium is a low-code platform for rapid development.

On it, you can create: web services, bots, mobile applications, landing pages, etc.

Since the code runs in the cloud, you don't need external hosting and there is no deployment stage. You simply write code, save the file - and it runs immediately.

Chatium supports both client-side code (HTML/CSS/JavaScript) and server-side TypeScript.

You can call external APIs, configure delayed code execution, use an internal database, and file storage for images, videos, or static files such as archives and PDFs.


How It Works

Each account provides a file system where you can place your files and folders.

Files are immediately available and can either be served to the user "as is" (these are files with .html/.css/.js extensions):

// file.html
<html>
  <title>This file will be served "as is"</title>
  <body>
    This method can be used for landing page layouts.
  </body>
</html>

Or they can be executed on the server and return their execution result:

// serverfile.tsx
app.html('/', async (ctx, req) => {
  let record = await table.findOneBy(ctx, {})
  return <html>
    <h1>{record.title}</h1>
    <div>{record.description}</div>
    <p>
      This method can be used for dynamic applications.
    </p>
  </html>
})

Mobile Development

Chatium provides a very simple way to create native mobile applications using server-side code.

Creating mobile applications is based on the Server Driven UI principle - the server returns the application screen along with the layout in a special JSON format for each user request.

app.screen('/', () => {
  return (
    <screen title="Hello world!">
      <text class="section">First screen</text>
    </screen>
  )
})

Example of a mobile screen

You write code on the server that delivers the screen, while the mobile application renders the user interface.

Since mobile applications are developed in the same environment and with the same code as the website, it results in a connected architecture that is very easy to maintain and modify.


Authorization

Each request to the server is made on behalf of a user, and there is a convenient API within the code to obtain current user data.

This allows you to easily restrict access to certain screens by requiring authorization, and others by requiring a specific user role.

import {requireRealUser, requireAccountRole} from '@app/auth'

app.screen('/', () => {
  requireRealUser(ctx)
  return (
    <screen title="Personal Account">
      <text class="section">
        This screen will request authorization.
      </text>
    </screen>
  )
})

app.screen('/admin', () => {
  requireAccountRole(ctx, 'Admin')
  return (
    <screen title="Admin Panel">
      <text class="section">
        This screen is only available to administrators.
      </text>
    </screen>
  )
})

Chatium supports various authorization methods (by default, methods like Email and SMS work), and in each account, you can choose "how users will be authorized." If a method is missing, you can add your own.


Modular Architecture

The main strength of Chatium lies in its modules. When developing a web service or mobile application, 80% of tasks are common tasks already existing in businesses - order processing, payments, task management, business process automation, newsletters.

Chatium already has ready-made modules that solve most tasks, so you can either build your solution from existing modules without programming at all or add what makes your service unique.

Any code can be wrapped and turned into a plugin that can be connected from other accounts.

This allows for the reuse of solutions from other developers and avoids creating your own solutions for CMS/CRM/Mailings, etc., while still having all the flexibility for customization.


Hooks

Hooks are pieces of code that you can insert into already existing modules. For example, you can redesign a module by inserting your layout or add the blocks you need to a user card.

// Hook showing a page with a non-existent address
app.accountHook('404', (ctx, params) => {
  return ctx.resp.html('<h2>This address does not exist</h2>')
})

Internal Database

Most web services require data storage. In Chatium, the Heap database is available, which allows you to declare a table directly in the code and use it immediately - working with records in the table as typed objects (using the full power of TypeScript typing):

import {Heap} from '@app/heap'
import {jsx} from '@app/html-jsx'

// Declaring a table with two fields - name and age
const myTable = Heap.Table('students', {
  name: Heap.String(),
  age: Heap.Optional(Heap.Number()),
})

// Displaying its records on the screen
app.get('/', async (ctx, req) => {
  let records = myTable.findAll(ctx)
  return <html>
    <table>
      {records.map(record => {
        return <tr>
          <td>{record.name}</td>
          <td>{record.age}</td>
        </tr>
      })}
    </table>
  </html>
})

File Service

The most common task when creating your web service is storing and processing media files (images, archives, and videos). Chatium provides an internal API that allows you not to worry about the technical side of this task. At a physical level, triple redundancy of files, CDN, image resizing, and video streaming are supported.

Learn more about the file service


Delayed Actions

Some code does not need to be executed immediately; instead, the task should be postponed and executed after some time. Also, there may be code that takes a long time to execute and should run in the background.

import { scheduleJobAfter } from '@app/jobs'
import { showToast } from '@app/ui'

app.screen('/', async (ctx, req) => {
  return (
    <screen>
      <button onClick={setAction.apiCall({})}>
        Remind me in half an hour
      </button>
    </screen>
  )
})

const setAction = app.apiCall('set-alarm', async () => {
  await scheduleJobAfter(ctx, 30, 'min', alarmJob.path(), {})
  return showToast('Task scheduled')  
})

const alarmJob = app.job('run-alarm', () => {
  // Code that will be called at the right time goes here
})

Quick Start

Implementing your first project will take no more than 30 minutes. Let's get started