In our previous blog post, we explored schema validation and created our Plan schema with CRUD operations. Today, we'll build upon that by implementing a REST API for our admin panel to manage these plans effectively.

Building SaaS Website #12: REST API Development
In our previous blog post, we explored schema validation and created our Plan schema with CRUD operations. Today, we'll build upon that by implementing a REST API for our admin panel to manage these plans effectively.
What We'll Build
We'll create an API that allows administrators to:
- View all subscription plans
- Get details of a specific plan
- Create new plans
- Update existing plans
- Delete plans
Let's start by setting up our API routes:
How Total.js API Routing Works
In Total.js, API routing is designed to be efficient and simple. Here's what's happening:
- We define one main endpoint (usually
/api/
)- We use
?
which gets replaced byCONF.$api
(defaults to/api/
) - All our API operations go through this single endpoint
- We use
- When making requests:
- All requests use POST method
- The body specifies which schema and operation to use
- The framework handles routing to the correct schema action
For example, to update a plan, instead of directly calling /api/plans_update/123
, the request would look like:
This approach means:
- One endpoint handles all our API operations
- Simpler routing management
- Better performance
- Easy to add new operations
These routes directly connect to those schema actions we created. The +API
(notice the +
) prefix ensures these routes are protected and only accessible to authenticated administrators.
Testing It Out
Our API will be used by the admin panel we'll build in the next blog post. For now, you can test it using your preferred API testing tool.
Benefits for our Admin Panel
This routing system gives us several advantages:
- Better performance (all routes use one endpoint)
- Built-in support for data encryption
- Automatic error handling
- Easy to maintain and extend
- Works seamlessly with our schemas
In real use, when our admin panel makes a request, it's all handled automatically by Total.js. We don't need to worry about the underlying mechanism - it just works!
What's Next?
In our next post, we'll create a beautiful admin interface that uses this API to manage subscription plans. We'll build a dashboard where administrators can easily view and modify plans without dealing with the API directly.
Stay tuned for more SaaS development insights! 🚀
Other posts from Total.js Platform
- 2025-09-05How to create Google Gemini AI component in Total.js Flow
- 2025-09-01August report 2025
- 2025-08-25IoT platform — Total.js
- 2025-08-22How to install OpenPlatform — IoT platform
- 2025-08-18Total.js Tables is here!
- 2025-08-18How to install Flow — IoT platform
- 2025-08-15How to install OpenReports — IoT platform
- 2025-08-08How to install stream to IoT platform — Total.js
- 2025-08-04July report 2025
- 2025-08-01How to install IoT platform — Total.js