Frameworks
React on Stackap
A React app runs on Stackap as a static single-page app when it is built with Vite or Create React App, and as a server when it is built with Next.js; React itself is not what Stackap detects.
How Stackap recognizes React
Stackap never looks for react in your dependencies. It looks at the tool that builds the app. If that tool is Vite, Create React App (react-scripts), Vue CLI or Parcel, with a build script and no server-rendering framework, the app is served as static files. If the app depends on next, it is a Next.js app. Anything else with a start script runs as a plain Node app.
What Stackap builds
For a React single-page app the generated image runs your build, then copies the first of the usual output folders that contains an index.html. A Vite app writes to dist and a Create React App project writes to build; both are on the list. If none contains an index.html, the build stops with a message naming the folders it looked in.
The web server in front of the files sends every path that is not a real file to index.html, so a client-side router such as React Router can handle a deep link like /account/settings opened directly or refreshed.
Create React App is no longer recommended for new projects by the React team, and its build tooling is old, so a new app is better started on Vite. Existing Create React App projects build and are served the same way.
What a React project needs
- A
buildscript that produces anindex.htmlin one of the standard folders. - Public values prefixed the way your tool requires,
VITE_for Vite andREACT_APP_for Create React App. They are compiled into the files, so none may hold a secret. - A router configured for the root of the domain, not a sub-path, unless you have set its base path to match.
- A separate backend for anything that needs a secret or a database, since a single-page app has no server of its own.
Verification status
The single-page-app path has a real Docker build in the platform's test suite, including the index.html fallback.
Still to verify: React Server Components, streaming server rendering, or any React framework with its own server runtime other than Next.js. Those need a server, and the static path will not run one.
Early-access scope
- Only the browser half of React is served. Server components and server rendering need Next.js or a Node server of your own.
- Because unknown paths return the app shell, a mistyped URL is a 200 response with the app's own not-found screen, not an HTTP 404. That matters for search engines, so prefer a pre-rendering tool if you rely on crawling.
- A React Native or Expo project is not a web app and is out of scope.
- No content delivery network in front of the files.
Questions
Do I need Next.js to host React?
Why is my environment variable undefined?
VITE_ or REACT_APP_, and remember it is then readable by every visitor.Stackap is in early access. Tell us what you run and we will reply with a straight answer about whether it fits.
Ask for an invitationLast updated .