Project Structure and Tech Stack
Before reading this page, make sure you have your first Portal running by following the AI Portal Quick Start.
Most day-to-day development can be left to the AI. Still, knowing the template's structure lets you tell whether the AI put its code in the right place, and makes problems easier to locate.
Tech stack
The Portal template is based on @nocobase/portal-template-default, with source at nocobase/portal-template-default.
This combination is the frontend stack AI is most familiar with today, which makes what it writes more accurate.
The Portal is a pure frontend project for now, with business logic handled through NocoBase's API, standard components, and so on. Support for having the AI Agent write Portal backend code is coming.
Directory structure
A few key locations:
src/app/routes.tsx— Route structure. Authenticated and unauthenticated routes are separate, and routes provided by extensions are mounted automaticallysrc/app/extensions.tsx— Extension loading, usingimport.meta.globto scansrc/extensions/*/extension.tsxsrc/providers/data.ts— Refine's data provider, translating Refine's query syntax into NocoBase API parameterssrc/lib/nocobase/client.ts—NocoBaseClient, the low-level wrapper behind every requestsrc/components/ui/— 60-odd shadcn/ui components, ready to use
Business pages usually go under src/extensions/, one directory per feature module. See Standard Components and Extensions.
Key files
Environment variables
nb portal dev and nb portal deploy write these for you, so you usually don't need to touch them. The last three only need aligning when the server has customized how auth tokens are stored.
During development, if NOCOBASE_API_URL is an absolute address, Vite sets up a proxy to forward requests, so you don't have to deal with CORS yourself.
Common commands
These are the ones you'll use day to day. Dependency installation, environment variable refreshing, and builds are all handled by the CLI behind the scenes:
For the full parameters of each command, see the nb portal Command Reference.
Where the dev workspace lives
A Portal's dev workspace goes into the directory you were in when you ran nb portal create or nb portal pull:
You can point it elsewhere with --path when creating or pulling. The built deployment artifacts go somewhere else — under the target application's storage, kept in sync by nb portal deploy, and not something you normally deal with.
If you're not sure where a Portal's dev workspace is, just check:
Related Links
- AI Portal Quick Start — Get your first AI-written frontend entry running
- Standard Components and Extensions — The shadcn/ui component base and the extension mechanism
- Deployment and Source Management — The build and deploy flow, and source storage
- Building with an AI Agent — Drive the AI to write pages in natural language
nb portal info— Check where a Portal's dev workspace is

