SkillAgentSearch skills...

Daptin

Daptin - Backend As A Service - GraphQL/JSON-API Headless CMS

Install / Use

/learn @daptin/Daptin

README

<h1 align="left"> daptin <br> </h1> <p align="center"> <a href="https://travis-ci.org/daptin/daptin"><img alt="Travis" src="https://img.shields.io/travis/daptin/daptin.svg?style=flat-square"></a> <a href='https://semaphoreci.com/artpar/daptin'> <img src='https://semaphoreci.com/api/v1/artpar/daptin/branches/master/badge.svg' alt='Build Status'></a> <a href='https://circleci.com/gh/daptin/daptin'> <img src='https://circleci.com/gh/daptin/daptin.svg?style=svg' alt='Build Status'></a> <p align="center"> <a href="/LICENSE"><img alt="Software License" src="https://img.shields.io/badge/LICENSE-LGPL%20v3-brightgreen.svg?style=flat-square"></a> <a href="https://goreportcard.com/report/github.com/daptin/daptin"><img alt="Go Report Card" src="https://goreportcard.com/badge/github.com/daptin/daptin?style=flat-square"></a> <a href="http://godoc.org/github.com/daptin/daptin"><img alt="Go Doc" src="https://img.shields.io/badge/godoc-reference-blue.svg?style=flat-square"></a> </p> <p align="center"> <a href="https://codecov.io/gh/daptin/daptin"><img alt="Codecov branch" src="https://img.shields.io/codecov/c/github/daptin/daptin/master.svg?style=flat-square"></a> <a href="https://github.com/daptin/daptin/releases/latest"><img alt="Release" src="https://img.shields.io/github/release/daptin/daptin.svg?style=flat-square"></a> </p> <p align="center"> <a href="https://discord.gg/t564q8SQVk"><img src="https://img.shields.io/badge/JOIN-ON%20DISCORD-blue&?style=for-the-badge&logo=discord"></a> </p> <p align="center"> <a href="https://github.com/daptin/daptin/releases">Download</a> • <a href="https://daptin.github.io/daptin/">Documentation</a> • <a href="https://join.slack.com/t/daptin/shared_invite/enQtMzM1NTM1NTkyMDgzLTVlYzBlMmM4YjMyOTk0MDc5MWJmMzFlMTliNzQwYjcxMzc5Mjk0YzEyZDIwYTljZmE5NDU3Yjk3YzQ3MzhkMzI">Community</a> </p>
./daptin
.
. // logs truncated for brevity
.
INFO[2024-10-16 11:08:58] Listening websocket server at ... /live
INFO[2024-10-16 11:08:58] Our admin is [artpar@gmail.com]
INFO[2024-10-16 11:08:58] [ProcessId=86403] Listening at port: :6336
INFO[2024-10-16 11:08:58] Get certificate for [Parths-MacBook-Pro.local]: true
INFO[2024-10-16 11:08:58] Listening at: [:6336]
INFO[2024-10-16 11:08:58] TLS server listening on port :6443
INFO[2024-10-16 11:09:03] Member says: Message<members: Joining from 192.168.0.125:5336>

Server is up, sqlite database is used since we did not specify mysql or postgres.

signup, signin, user_account and usergroup

signup

call the signup "action" api to create a new user_account

curl 'http://localhost:6333/action/user_account/signup' -X POST \
--data-raw '{"attributes":{"email":"artpar@gmail.com","password":"artpar@gmail.com","name":"artpar@gmail.com","passwordConfirm":"artpar@gmail.com"}}'

On a fresh instance all actions are allowed to be executed by guests, so you shouldn't see this

[
    {
        "Attributes": {
            "message": "http error (403) forbidden and 0 more errors, forbidden",
            "title": "failed",
            "type": "error"
        },
        "ResponseType": "client.notify"
    }
]

You should see this

[
  {
    "ResponseType": "client.notify",
    "Attributes": {
      "__type": "client.notify",
      "message": "Sign-up successful. Redirecting to sign in",
      "title": "Success",
      "type": "success"
    }
  },
  {
    "ResponseType": "client.redirect",
    "Attributes": {
      "__type": "client.redirect",
      "delay": 2000,
      "location": "/auth/signin",
      "window": "self"
    }
  }
]

Sign in to get a JWT Bearer token

curl 'http://localhost:6336/action/user_account/signin' \
--data-raw '{"attributes":{"email":"artpar@gmail.com","password":"artpar@gmail.com"}}'

[
    {
        "Attributes": {
            "key": "token",
            "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFydHBhckBnbWFpbC5jb20iLCJleHAiOjE3MjkzMjExMjIsImlhdCI6MTcyOTA2MTkyMiwiaXNzIjoiZGFwdGluLTAxOTIyOCIsImp0aSI6IjAxOTI5NDFmLTI2MGUtN2I0Ni1hMWFlLWYxMGZhZTcwMDE3OSIsIm5hbWUiOiJhcnRwYXJAZ21haWwuY29tIiwibmJmIjoxNzI5MDYxOTIyLCJzdWIiOiIwMTkyMmUxYS1kNWVhLTcxYzktYmQzZS02MTZkMjM3ODBmOTMifQ.H-GLmXCT-o7RxXrjo5Of0K8Nw5mpOOw6jgoXnd5KUxo"
        },
        "ResponseType": "client.store.set"
    },
    {
        "Attributes": {
            "key": "token",
            "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFydHBhckBnbWFpbC5jb20iLCJleHAiOjE3MjkzMjExMjIsImlhdCI6MTcyOTA2MTkyMiwiaXNzIjoiZGFwdGluLTAxOTIyOCIsImp0aSI6IjAxOTI5NDFmLTI2MGUtN2I0Ni1hMWFlLWYxMGZhZTcwMDE3OSIsIm5hbWUiOiJhcnRwYXJAZ21haWwuY29tIiwibmJmIjoxNzI5MDYxOTIyLCJzdWIiOiIwMTkyMmUxYS1kNWVhLTcxYzktYmQzZS02MTZkMjM3ODBmOTMifQ.H-GLmXCT-o7RxXrjo5Of0K8Nw5mpOOw6jgoXnd5KUxo; SameSite=Strict"
        },
        "ResponseType": "client.cookie.set"
    },
    {
        "Attributes": {
            "message": "Logged in",
            "title": "Success",
            "type": "success"
        },
        "ResponseType": "client.notify"
    },
    {
        "Attributes": {
            "delay": 2000,
            "location": "/",
            "window": "self"
        },
        "ResponseType": "client.redirect"
    }
]

We will use

export TOKEN=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6ImFydHBhckBnbWFpbC5jb20iLCJleHAiOjE3MjkzMjExMjIsImlhdCI6MTcyOTA2MTkyMiwiaXNzIjoiZGFwdGluLTAxOTIyOCIsImp0aSI6IjAxOTI5NDFmLTI2MGUtN2I0Ni1hMWFlLWYxMGZhZTcwMDE3OSIsIm5hbWUiOiJhcnRwYXJAZ21haWwuY29tIiwibmJmIjoxNzI5MDYxOTIyLCJzdWIiOiIwMTkyMmUxYS1kNWVhLTcxYzktYmQzZS02MTZkMjM3ODBmOTMifQ.H-GLmXCT-o7RxXrjo5Of0K8Nw5mpOOw6jgoXnd5KUxo 

for the rest of the api calls. This is a JWT token with following data

{
  "email": "artpar@gmail.com",                    // user email
  "exp": 1729321122,                              // token expiry
  "iat": 1729061922,                              // token issued at time
  "iss": "daptin-019228",                         // token issuer (your daptin instance)
  "jti": "0192941f-260e-7b46-a1ae-f10fae700179",  // unique identifier for this token
  "name": "artpar@gmail.com",                     // user name
  "nbf": 1729061922,                              // token valid not before timestamp
  "sub": "01922e1a-d5ea-71c9-bd3e-616d23780f93"   // user reference id
}

So you have an account and a token to authenticate as that account. But do you need it? No. Call to fetch all user accounts works without any authorization

curl http://localhost:6333/api/user_account
{
  "links": {
    "current_page": 1,
    "from": 0,
    "last_page": 1,
    "per_page": 10,
    "to": 10,
    "total": 1
  },
  "data": [
    {
      "type": "user_account",
      "id": "01929429-3d8f-7e53-8f15-a663e05fb01b",
      "attributes": {
        "__type": "user_account",
        "confirmed": 0,
        "created_at": "2024-10-16T07:09:43.86360642Z",
        "email": "artpar1@gmail.com",
        "name": "artpar1@gmail.com",
        "password": "",
        "permission": 2097151,
        "reference_id": "01929429-3d8f-7e53-8f15-a663e05fb01b",
        "updated_at": "2024-10-16T07:09:43.863622045Z",
        "user_account_id": "01929429-3d8f-7e53-8f15-a663e05fb01b"
      },
      "relationships": { /// ...}
    }
  ]
}

And so does all the data in all other tables (eg site, cloud_store, document, usergroup). And you can call update and delete APIs as well (not demonstrated here, but you can try, delete the sqlite database file after you are done playing to reset it all)

As the first user, it is an option for you to leave it open or enable the multi-tier permission and becoming the Administrator

curl 'http://localhost:6336/action/world/become_an_administrator' --compressed -X POST \
-H "Authorization:  Bearer $TOKEN" --data-raw '{}'

At this point, all other apis are locked-down and only accessible by administrator, that is you. You want to open up few or many of actions to guests or users.

... Will be updated soon

📊 Self-Documentation Progress (Multi-Session Project)

Overall Progress: 71% Complete (37/52 features documented)

Session Tracking:

  • Session 1: Foundation (7 features) - Configuration, Statistics, Meta, Health, JS Models, Aggregation ✅
  • Session 2: Real-time & Communication (12 features) - WebSocket, YJS, SMTP, CalDAV, FTP, Feeds ✅
  • Session 3: Advanced Data & Analytics (8 features) - Aggregation, GraphQL, Import/Export, Relationships ✅
  • Session 4: Infrastructure & Configuration (10 features) - Config API, Rate Limiting, GZIP, Caching, CORS, TLS ✅
  • Session 5: Workflow & Automation (Planned)
  • Session 6: Client Integration & Developer Experience (Planned)
  • Session 7: Final Documentation & Polish (Planned)

Documentation Artifacts:

  • /openapi.yaml - Self-updating API documentation
  • SELF_DOCUMENTATION_MASTER_PLAN.md - Complete roadmap
  • SESSION_HANDOFF.md - Progress tracking
  • NEXT_SESSION_PROMPT.md - Next session guide

Overview

View on GitHub
GitHub Stars1.9k
CategoryContent
Updated2d ago
Forks116

Languages

Go

Security Score

100/100

Audited on Mar 22, 2026

No findings