Project structure
A StartupJS project is built on top of Expo, so the folder layout follows standard Expo Router conventions. This chapter explains the key folders and files.
Typical layout
Routing with Expo Router
StartupJS uses Expo Router for file-based routing. Every file inside app/ becomes a route automatically:
app/index.tsx→/app/about.tsx→/aboutapp/users/[id].tsx→/users/:id(dynamic segment)
Layouts
_layout.tsx files wrap all sibling and child routes. The root layout in app/_layout.tsx is where you add StartupjsProvider:
Navigation
Use Expo Router's Link component or the router object for navigation:
Platform-specific files
StartupJS uses React Native, so your code runs on web, iOS, and Android by default. If you need platform-specific behavior, you can split files:
*.web.js-- used only for web builds*.js-- used everywhere (shared or native)
If both Something.web.js and Something.js exist, the web bundler uses the .web.js version while native uses the .js version.
When to use platform files
- A library only works on one platform (for example, a web-only date picker).
- A screen has major UX differences between web and mobile. Use this sparingly -- most code should be shared.
Server
The server/ folder contains your backend configuration. A basic server/index.js might look like:
Styles
Each component can have an accompanying .styl file for styles written in Stylus. Use styleName to connect styles to components: