OrbitOS is an open-source, Web OS-style desktop that runs in the browser. It has draggable, snappable windows, a taskbar, built-in apps, an App Store, real-time collaborative notes and optional Google Drive sync. It is one Next.js app: the UI and the API (Next.js API routes) live in the same codebase, with MongoDB for storage and Socket.io for real-time features.
Live site: https://orbitos.codehubbers.com
You need Docker with the Compose plugin.
git clone https://github.com/codehubbers/OrbitOS
cd OrbitOS
docker compose upOpen http://localhost:3000 and register an account. MongoDB starts in its own container, and the app hot-reloads when you edit files. See Setup for running without Docker and for the optional settings.
- 🖥️ Desktop with wallpapers, a taskbar with Start Menu and clock, and a lock screen
- 🪟 Windows you can drag, resize, minimize, maximize, snap to screen edges and group into tabs
- 🧩 Built-in apps: Notes, Browser, Settings, File Manager, Calculator, System Monitor, Weather, Music Player and App Store
- 👥 Real-time collaborative Notes over Socket.io, with document sharing
- 🔐 Accounts with JWT sessions in HTTP-only cookies, password change and avatars
- ☁️ Optional Google sign-in and Google Drive sync
- 📦 App Store that installs third-party packages, with a validation and sandboxing layer
- 🎨 Light, dark and high-contrast themes, plus a theme registry for adding more
- 🌍 Multi-language UI: English, German, Spanish and Chinese (Simplified and Hong Kong)
| Area | What we use |
|---|---|
| Frontend | Next.js 15 (Pages Router), React 18, Tailwind CSS 3, Framer Motion, Heroicons, Lucide icons |
| Backend | Next.js API routes in src/pages/api/ (there is no separate Express server) |
| Data | MongoDB with Mongoose (src/lib/mongodb.js, src/models/) |
| Real-time | Socket.io (src/pages/api/socket/io.js, CollaborationContext), Quill Delta for document changes |
| Auth | JWT (jsonwebtoken), bcrypt password hashing, request validation with express-validator |
| Integrations | Google OAuth and Drive (google-auth-library, @googleapis/drive), Open-Meteo weather API, GitHub for App Store packages |
| Tooling | Jest + Testing Library, ESLint, Prettier, Husky + lint-staged, Commitlint (Conventional Commits) |
| Runtime | Node.js 20+, Docker (dev and production images) |
| Language | JavaScript |
flowchart LR
U["Browser"] --> FE["Next.js pages + React UI<br/>src/pages, src/components"]
FE --> API["Next.js API routes<br/>src/pages/api"]
FE <-->|websocket| IO["Socket.io<br/>/api/socket/io"]
API --> DB[("MongoDB<br/>via Mongoose")]
IO --> DB
API --> G["Google OAuth + Drive API"]
API --> W["Open-Meteo weather API"]
API --> GH["GitHub packages repo<br/>App Store"]
The desktop (src/components/Desktop.js) reads the list of apps from
AppRegistry and renders each open app inside a window. App UIs live in
src/pages/apps/. React Context providers in src/context/ hold global
state, such as open windows, auth, theme, settings, language and
collaboration.
OrbitOS/
├── .github/ # CI workflow, issue forms and PR template
├── .husky/ # Git hooks: tests + lint-staged on commit, commitlint on message
├── deploy/ # Production Docker Compose file and deploy.sh
├── docs/ # Docs site and archived course instructions
├── public/
│ ├── backgrounds/ # Desktop wallpapers
│ ├── icons/ # App icons and favicons
│ └── sounds/ # Startup sound
├── scripts/ # Maintenance scripts (e.g. generate-app-icons.js)
├── src/
│ ├── components/ # Desktop, Taskbar, windows, lock screen, widgets
│ │ ├── auth/ # Login and register forms
│ │ ├── collaboration/ # Collaboration toolbar for Notes
│ │ └── settings/ # Settings UI pieces
│ ├── context/ # React Context: App, Auth, Collaboration, Drive, I18n, Lock, Music, Settings, Theme
│ ├── hooks/ # Window drag/resize/snap/grouping, file dialogs, weather, lock screen
│ ├── lib/ # Server and shared helpers: auth, cookies, MongoDB connection, i18n, weather
│ ├── locales/ # Translation files (en, de, es, zh-CN, zh-HK)
│ ├── middleware/ # API middleware: permissions, rate limiting, validation
│ ├── models/ # Mongoose models: User, File, Document
│ ├── pages/
│ │ ├── api/ # Backend API routes (see "API endpoints")
│ │ ├── apps/ # The UI of each built-in app
│ │ ├── index.js # The desktop
│ │ └── login.js, register.js, auth.js
│ ├── styles/ # Global CSS (Tailwind)
│ ├── system/
│ │ ├── apps/ # App definitions (id, name, icon, component key)
│ │ ├── components/ # Window chrome: title bar, resize handles, snap preview, groups
│ │ ├── config/ # Window constants
│ │ ├── security/ # App Store package validation and loading
│ │ └── services/ # AppRegistry, snapping, window groups, tabs, clipboard, notifications, top bar
│ └── themes/ # ThemeRegistry plus light, dark and high-contrast themes
├── tests/ # Jest tests
├── docker-compose.yml # Local development: app + MongoDB
├── Dockerfile # Dev, build and production stages
├── eslint.config.mjs
├── next.config.js
├── tailwind.config.js
└── package.json
The quick start is all you need. Optionally,
copy .env.example to .env first to change settings
(see Environment variables).
docker compose --profile tools upalso starts mongo-express at http://localhost:8081 to browse the database.- Set
ORBITOS_DEV_PORTin.envto change the host port (default 3000), andMONGO_PORTif 27017 is already taken by a local MongoDB. - After changing dependencies in
package.json, rebuild withdocker compose up --build -V. The-Vrenews the anonymousnode_modulesvolume while leaving your database alone. Avoiddocker compose down -v: it also deletes the namedmongo-datavolume and wipes your database. - On macOS/Windows the file watcher polls (via
WATCHPACK_POLLING), which costs a little CPU; native Linux doesn't need it.
How .env maps into compose: MONGODB_URI and PORT are overridden for
the containers (MongoDB is the mongo service, not localhost;
next dev always listens on 3000 inside). Everything else in .env,
such as JWT_SECRET and NEXT_PUBLIC_ENABLE_LOCAL_ADMIN, is passed
through as-is. ORBITOS_DEV_PORT and MONGO_PORT are read by compose
itself when publishing ports.
You need Node.js 20 or newer and a MongoDB server. If you don't have
MongoDB installed, docker compose up mongo starts just the database on
localhost:27017.
git clone https://github.com/codehubbers/OrbitOS
cd OrbitOS
cp .env.example .env # then edit MONGODB_URI / JWT_SECRET if needed
npm install
npm run devOpen http://localhost:3000. The API is served by the same server under
/api (check it with curl http://localhost:3000/api/health).
Copy .env.example to .env. Only MONGODB_URI is required to start the
app; everything else is optional or has a development default.
| Variable | Required | What it does |
|---|---|---|
MONGODB_URI |
Yes | MongoDB connection string, e.g. mongodb://localhost:27017/orbitos. The API fails with "MONGODB_URI is not set" without it. Docker Compose sets it for you. |
JWT_SECRET |
Yes, outside local dev | Secret used to sign session tokens. Falls back to a fixed, insecure default if unset, so always set a long random value on any shared or public server. |
NODE_ENV |
No | development or production. Anything other than development sets the Secure flag on session cookies and turns off the local admin login. next dev and next build set this themselves. |
NEXT_PUBLIC_ENABLE_LOCAL_ADMIN |
No | true shows "Continue as Local Admin" on the login screen. Only works when NODE_ENV=development and the request comes from your own machine. Never enable it on a server. |
PORT |
No | Left over from the old standalone Express server. The app code doesn't read it; Docker Compose overrides it. |
NEXT_PUBLIC_API_URL |
No | Left over from the old standalone Express server. The app code doesn't read it; the API is always served from the same origin under /api. |
GOOGLE_CLIENT_ID |
No | Google OAuth client ID. Needed for Google sign-in and Drive sync. |
GOOGLE_CLIENT_SECRET |
No | Google OAuth client secret, paired with GOOGLE_CLIENT_ID. In the Google Cloud console, add <your origin>/api/auth/google/callback (e.g. http://localhost:3000/api/auth/google/callback) as an authorized redirect URI. |
ORBIT_PACKAGES_REPO |
No | owner/repo on GitHub that the App Store lists approved packages from, e.g. codehubbers/OrbitOSPackages. |
GITHUB_TOKEN |
No | GitHub token used when fetching the App Store package list (avoids GitHub's low anonymous rate limit). |
ORBITOS_LOCAL_ADMIN_DOCKER |
No | Set by docker-compose.yml so the local admin login works inside the container. You don't need to set it yourself. |
ORBITOS_DEV_PORT, MONGO_PORT |
No | Read by docker-compose.yml only: host ports for the app (default 3000) and MongoDB (default 27017). |
For the production Docker setup, ORBITOS_PORT and deploy/.env are
described under Deployment.
npm run dev- Start the Next.js development server (UI and API) on http://localhost:3000npm run build- Build for productionnpm run start- Start the production server (runnpm run buildfirst)npm run dev:all- Run the tests, then start the development servernpm test- Run the Jest test suitenpm run lint- Lint the codebase with ESLint (next/core-web-vitalsrules)npm run lint:fix- Lint and auto-fix what ESLint can fixnpm run format- Format the codebase with Prettiernpm run format:check- Check formatting without changing files
ESLint and Prettier also run on staged files in the Husky pre-commit hook
(via lint-staged), so lint errors block the commit. The hook also runs
the tests, and Commitlint checks the commit message.
All routes live in src/pages/api/ and are served under /api.
| Area | Routes |
|---|---|
| Health | GET /api/health |
| Auth | /api/auth/register, /login, /logout, /me, /status, /change-password, /verify-password, /check-username/[username], /local-admin |
/api/auth/google/login, /callback, /me, /logout |
|
| Users | /api/users, /api/users/avatar, /api/users/preferences |
| Files | GET/POST /api/files, GET/DELETE /api/files/[id], /api/files/download, /api/files/share, /api/files/database (Google Drive sync) |
| Documents | POST /api/documents/share |
| Apps | POST /api/apps/install, /api/apps/uninstall, /api/packages/approved, /api/packages/dev |
| Weather | /api/weather (proxies Open-Meteo, cached) |
| Real-time | /api/socket/io (Socket.io endpoint for collaborative documents) |
| App | Definition (src/system/apps/) |
UI (src/pages/apps/) |
|---|---|---|
| Notes | NotesApp.js |
notes.js |
| Browser | BrowserApp.js |
browser.js |
| Settings | SettingsApp.js |
settings.js |
| File Manager | FilemanagerApp.js |
filemanager.js |
| Calculator | Calculator.js |
calculator.js |
| Monitor | MonitorApp.js |
monitor.js |
| Weather | WeatherApp.js |
weather.js |
| Music Player | MusicPlayerApp.js |
musicplayer.js |
| App Store | AppStoreApp.js |
appstore.js |
The Notes app is a rich text editor with find and replace, word count, local and Google Drive save, and real-time collaboration. It was originally built by @Gordon.H.
All colors and styles come from theme files in src/themes/
(lightTheme.js, darkTheme.js, highContrastTheme.js). For example, the
taskbar in src/themes/darkTheme.js:
// src/themes/darkTheme.js
export const darkTheme = {
// ...
taskbar: 'bg-black/30 backdrop-blur-lg border-t border-white/20',
// ...
};bg-black/30: the color and transparency (black at 30% opacity). Usebg-black/50to make it less transparent.backdrop-blur-lg: the "frosted glass" effect. Usebackdrop-blur-xlfor more blur, or remove it for none.
To add a new theme, create a file in src/themes/ that exports a theme
object with a unique id, then import it in src/themes/ThemeRegistry.js
and call this.register(yourTheme) in the constructor.
- Put the image in
public/backgrounds/. - Add its path to the
defaultWallpapersarray insrc/context/SettingsContext.js:
// src/context/SettingsContext.js
const defaultWallpapers = [
'/backgrounds/orbit-default.jpg',
'/backgrounds/orbit-default1.jpg',
'/backgrounds/my-new-wallpaper.jpg', // <-- your new wallpaper
];It then shows up in the Settings app.
Apps are registered in three places:
-
UI component. Create
src/pages/apps/mynewapp.jsand export a React component. -
Definition. Create
src/system/apps/MyNewApp.js. Thecomponentkey must be unique:// src/system/apps/MyNewApp.js import App from './App'; const myNewApp = new App({ id: 'mynewapp', name: 'My New App', icon: '/icons/apps/mynewapp.svg', component: 'mynewapp', // key used in Desktop.js }); export default myNewApp;
-
Registration. Import the definition in
src/system/services/AppRegistry.jsand add it tothis.apps. Then, insrc/components/Desktop.js, import the UI component and add it to theappComponentsmap under the same key:// src/components/Desktop.js import MyNewApp from '@/pages/apps/mynewapp'; const appComponents = { // ... mynewapp: MyNewApp, };
Third-party apps can also be published through the App Store package repo
(OrbitOSPackages); see
orbit.schema.json for the package manifest format.
The full guide, including the review rules, is in CONTRIBUTING.md. To report a security problem, follow SECURITY.md instead of opening an issue. Accessibility goals, known gaps and how to report a barrier are in ACCESSIBILITY.md.
- Find an issue (look for
good first issue) and comment that you'd like to take it, so a maintainer can assign you. - Fork the repo and create a branch, e.g.
feat/short-nameorfix/short-name. - Use Conventional Commits:
type(scope): summary, e.g.fix(calculator): keep history after reload. Commitlint enforces this. - Before opening a PR, make sure
npm testandnpm run lintpass and changed files are formatted with Prettier (the pre-commit hook does this for you). - Open a PR that references the issue (
Closes #123) and fill in the PR template. Add screenshots for UI changes.
Code style:
- JavaScript (not TypeScript), functional React components with hooks
- Tailwind CSS for styling, colors from the theme files
- New API routes go in
src/pages/api/, return consistent JSON errors, and use the middleware insrc/middleware/for validation, rate limiting and permissions - Add or update tests in
tests/for behavior you change - Keep components small and accessible (semantic HTML, ARIA labels, keyboard support)
The live site, https://orbitos.codehubbers.com, runs from this repo in Docker on our own server behind a Cloudflare Tunnel. Anything merged to main is deployed automatically once CI passes (see #123).
You need Docker with the Compose plugin.
git clone https://github.com/codehubbers/OrbitOS.git && cd OrbitOS
bash deploy/deploy.sh
curl http://127.0.0.1:4100/api/healthdeploy/deploy.sh pulls main and builds the image. It starts the app and MongoDB, then waits for the health check. On the first run it creates deploy/.env with a random JWT_SECRET. Put optional keys there too, such as GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET. That file is never committed.
What the compose setup does (deploy/docker-compose.yml):
- The app listens on
127.0.0.1:4100only. Put a reverse proxy or a Cloudflare Tunnel in front of it to make it public. - MongoDB has no published port and runs on an internal network with no internet access. Its data lives in the
orbitos_mongo-datavolume. - The app container runs as a non-root user. It has a read-only filesystem and all Linux capabilities dropped, with memory limits and log rotation.
Set ORBITOS_PORT to use a different local port.
- A job checks
mainevery 5 minutes. It deploys only when every GitHub check on the new commit is green, and rolls back if the health check fails. - The job's script and compose file live outside the repo and are owned by root. A merged PR can only change what runs inside the containers, not on the host.
- MongoDB is backed up every night to a private Cloudflare R2 bucket and kept for 14 days.
Need access to the server or the logs? Ask in Discord.
DEPLOYMENT.md has notes for deploying to Vercel with MongoDB Atlas instead.
- 💬 Discord: https://discord.gg/NW2YZACf4k — ask questions, share progress and pair up with other contributors
- 🐛 Bugs and ideas: GitHub issues
- ⭐ If you like OrbitOS, star the repo and tell a friend
This project is released under GNU GPLv3. For more details see LICENSE.