How to Build a SaaS Admin Panel With an AI Assistant in Next.js A developer published a step-by-step guide for building a SaaS admin panel with an integrated AI assistant in Next.js, starting from the Aniq UI Admin Dashboard Template 2 rather than a blank project. The walkthrough covers role-based access control, project and user management screens, English and Arabic localization, Docker and Vercel deployment options, and a configurable AI provider key gated by an ai_chat.use permission. Originally published on the Aniq UI blog https://www.aniq-ui.com/en/blog/build-saas-admin-panel-ai-assistant-nextjs . By the end of this guide you will have an internal admin panel with an AI assistant running on your computer and ready for a server. It is a Next.js dashboard with its own API behind it, and you build it from the Aniq UI Admin Dashboard Template 2 instead of starting from an empty folder. The steps work for a SaaS admin panel, a back office for a small company, or any internal tool where a team needs lists, roles and a way to ask questions about their own data. To keep it concrete, we walk one made-up company through the whole job, from the first download to a live address, and we stop at every point where something usually goes wrong. About this example Larkspur Software is an illustrative business we use to show the steps. It is not a client story, and the numbers in it are examples, not results. Most of the pain in an internal tool comes from choices made late. Settle these six before you open a terminal, and the rest of the guide goes faster. Who signs in, and what may each person do? Write the list of roles on paper first. The template ships five Super Admin, Admin, Manager, Editor, Viewer and you can reshape them, but it is easier to reshape with a plan. What are your records? The template comes with users, projects, tasks and app settings. If your business revolves around something else, such as orders or tickets, decide now whether you will rename what exists or add a new module to the API. Which languages? English and Arabic ship. A third language is possible but is more work, so know before you start whether you need it. Who pays for AI? Either the company holds one provider key on the server, or each person brings their own. The choice changes your bill and your privacy story, and step 8 covers both. Where will it run? A single small server using Docker, or Vercel for the dashboard with the API on a Docker host. Pick the shape early so you set the right addresses once. Which database? SQLite is the default and needs no setup. MySQL is a configuration change. A host without a persistent disk is the usual reason to pick MySQL. Larkspur Software is a small agency that builds web apps for other companies. The office needs one place to run its work. Here is what the team asks for: A sign-in for staff, with different levels of access: the owner sees everything, developers edit projects, contractors only read. A list of every client project, with its status, its environment staging or production and its current version. A list of client accounts, with a quick way to find the ones who never verified their email. An assistant that answers plain questions such as "which projects are blocked?" and shows the answer as a table or a chart. English and Arabic, because two client teams read Arabic. A first run on a laptop, then a small server on the agency's own domain. Control over who can use the assistant, since it can change records and the AI provider bills for usage. | Need | Where it lives | What you use | |---|---|---| | Staff with different access | Dashboard and API | Admin Management and Admin Roles screens; permissions named like projects.edit | | Client project tracking | Dashboard and API | Projects screen with status, environment, version and an English and Arabic name | | Client accounts | Dashboard and API | Users and Deleted users screens, filters, verify and restore actions | | Plain-language questions | Dashboard and API | AI Assistant screen, with a provider key from you | | English and Arabic | Dashboard | /en and /ar addresses, message files under messages/ | | Laptop, then a server | Docker and configuration | Docker Compose, .env files, a web server in front | | Control over the assistant | API | The ai chat.use permission on a role | There are three honest ways to get an admin panel with an AI assistant, and each fits a different team. From scratch. You get exactly the structure you want and nothing extra. You also build sign-in, roles with live updates, filtered lists, a chat interface that renders tables and charts, and the API behind all of it. This suits teams with an unusual product and plenty of engineering time. For everyone else it means a long stretch spent on screens that every admin panel needs. A hosted builder. A low-code or internal-tool service gets you a working screen quickly and handles hosting for you. In exchange you work inside its component set and its pricing model, and moving away later usually means rebuilding. Check what it charges per user, what you can export, and whether it supports right-to-left layouts before you commit. A template with source code. You start with finished screens, a working API and an assistant, and you own the code. You pay once for the template, host it yourself, and change anything you like. The cost is that you must be comfortable with Next.js, and later with NestJS if you extend the API. The license does not let you publish or resell the source, but it does cover unlimited projects, including ones for clients. Larkspur has developers on staff and wants to keep client data on its own server, so it takes the template route. If nobody on your team writes code, a hosted builder is the more realistic choice. This is a sample schedule for Larkspur, not a benchmark. Your own pace will differ. Week 1, get it running. Download the ZIP, start it with Docker, click through every screen, and try both sample accounts. Decide the six questions above. Week 2, make it theirs. Brand it, rebuild the roles, create the real staff accounts, and delete the sample admins. Week 3, load the work. Enter real projects and client accounts, add provider keys, and let two or three people use the assistant with real questions. Week 4, harden and ship. Set production environment values, deploy to the server, check the health address, and walk through the launch checklist near the end of this post. The template comes in three packages. The Full Stack package holds the dashboard and the NestJS API. The Admin Dashboard package is the dashboard alone, running against a small mock server built into it, with the sample records stored in your browser. The Backend API package is the API alone. Larkspur wants real data and a real assistant, so it takes Full Stack. If you only want to design screens first, the Admin Dashboard package is enough, and you can point it at an API later. If you already have a front end and only need the server, the Backend API package gives you the routes, the roles logic and the assistant's tools. Check: after the download, your account should show a ZIP named for the package you bought. Usually goes wrong: buying the dashboard package and expecting an API in it. The dashboard alone cannot store anything outside the browser. Install Docker Desktop or Docker Engine on Linux and nothing else. Then work through these sub-steps. 2a. Download. Open My templates in your Aniq UI account and download the Full Stack ZIP. Look at which package is chosen on the download page, because the folder names in the later steps depend on it. 2b. Unzip and open the folder. Unpack the archive and start a terminal inside the dashboard-2-full-stack folder on Windows, unpack it with File Explorer first . Look at the folder contents: you should see back-end , front-end and docker-compose.yml side by side. 2c. Start both apps. bash docker compose up --build On the first start Docker builds two images and seeds the database, so give it a few minutes. Later starts take seconds. Look at the terminal: it prints build progress first, and the dashboard waits until the API reports itself healthy. 2d. Open it. Go to localhost:3030 and use the account admin@example.com with the password Admin@123 . Arabic lives at /ar . The API answers at localhost:8000/api/health once its database is ready. What to check: the health address should answer, and the dashboard should list data on its first screen. What usually goes wrong: a port is already in use. If another program holds 3030 or 8000, create a file named .env next to docker-compose.yml and set DASHBOARD PORT=3040 or API PORT for the API , then run the same command again. A start that seems stuck is normally still seeding sample data. To stop the apps, press Ctrl+C. Your data stays in a Docker volume. Be careful with docker compose down -v : the -v deletes the volume, and the next start brings back fresh sample data. You will not use all of these, but each solves a real situation. The dashboard alone. With the Admin Dashboard package, you build one image and start one container. With no API address set, it runs on its mock server and needs no back end. Look at the folder name in the terminal: this package extracts to a different folder than the Full Stack one. Look at the build output: the dependencies and the build both happen inside the image, so the first build needs an internet connection. The API alone. With the Backend API package, you build an image and run it with a volume that holds the database file. The first run seeds that database with the sample records and accounts. Every route sits under /api , and you check it with the health address. Look at the files in the folder, which include a Dockerfile , package.json and .env.example . Look at the image being built: the API image is separate from the dashboard's. Look at the health check at the end: a working API answers with an ok status. Without Docker. Install Node.js 22.9 or newer and run corepack enable once. Start the API first, because the dashboard reads all its data from it. In back-end , copy the example settings, create the database with yarn seed , then run yarn dev . In front-end , copy the example settings and start it the same way. Look at the first terminal, which runs the API. Look at the second terminal, which runs the dashboard against the API from the first. The same approach works for the single-app packages. Look at how little is needed here: no .env file means the mock server answers. Look at the API terminal staying open while you use it. What usually goes wrong: a Node.js older than 22.9, which makes yarn dev fail on reading .env ; a Yarn that answers with version 1.22 because Corepack is off; and a dashboard that shows sample data even though you meant to use your API, because the API address was missing when it was built. The seed loads a small company's worth of records: a dozen admins, five roles carrying 25 permissions, 15 users, 15 projects, 10 tasks and 13 app settings, plus some deleted users and projects to practise restoring. Click through the sidebar from top to bottom, ending on the page that lists every UI component. Look at how the sidebar groups the screens, since you will rename and prune this menu later. Look at the top of the overview: key figures, charts, a calendar and quick tasks share one screen, and the widgets can be rearranged. Then sign out and sign in as john.smith@admin.com with the password admin123 . This account has the Viewer role. It can read every list but cannot create, edit or delete anything, and it cannot open the assistant. Seeing that difference early tells you how the permission system behaves, which matters for step 6. What to check: you can explain, in one sentence each, what Super Admin and Viewer can do. What usually goes wrong: people edit sample records first and then forget which data is real. Keep the sample data untouched until you are ready to replace it in bulk. All branding sits in the dashboard folder front-end in the Full Stack package . Run yarn dev there while you edit and the page reloads on every save. Four places matter most: src/config/brand.config.ts holds BRAND CONFIG : the name, the company, the page metadata and the installed-app details, in English and Arabic. public/assets/images/logo-for-lightmode.png and logo-for-darkmode.png are the two logos. Replace the files and keep the names. src/styles/theme-variables.css defines every colour once for light and once for dark. The brand colour is --primaryColor . messages/