Skip to content
codehubbersPublic

About

A collaborative Web OS–style project built with Next.js (frontend) and Node.js + Express (backend). Features a desktop-like UI, draggable windows, taskbar, and simple apps (Notes, Browser, Settings). Stage 1 focuses on setting up the project skeleton, UI components, and backend routes.

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

20 stars

Watchers

1 watching

Forks

Latest commit

 

History

261 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

OrbitOS

CI

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

Quick start in 3 commands

You need Docker with the Compose plugin.

git clone https://github.com/codehubbers/OrbitOS
cd OrbitOS
docker compose up

Open 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.

Features

  • 🖥️ 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)

Tech stack

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

How it fits together

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"]
Loading

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.

Project structure

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

Setup

With Docker (recommended)

The quick start is all you need. Optionally, copy .env.example to .env first to change settings (see Environment variables).

  • docker compose --profile tools up also starts mongo-express at http://localhost:8081 to browse the database.
  • Set ORBITOS_DEV_PORT in .env to change the host port (default 3000), and MONGO_PORT if 27017 is already taken by a local MongoDB.
  • After changing dependencies in package.json, rebuild with docker compose up --build -V. The -V renews the anonymous node_modules volume while leaving your database alone. Avoid docker compose down -v: it also deletes the named mongo-data volume 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.

Without Docker

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 dev

Open http://localhost:3000. The API is served by the same server under /api (check it with curl http://localhost:3000/api/health).

Environment variables

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.

Available scripts

  • npm run dev - Start the Next.js development server (UI and API) on http://localhost:3000
  • npm run build - Build for production
  • npm run start - Start the production server (run npm run build first)
  • npm run dev:all - Run the tests, then start the development server
  • npm test - Run the Jest test suite
  • npm run lint - Lint the codebase with ESLint (next/core-web-vitals rules)
  • npm run lint:fix - Lint and auto-fix what ESLint can fix
  • npm run format - Format the codebase with Prettier
  • npm 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.

API endpoints

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
Google /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)

Applications

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.

Customizing the look and feel

Themes

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). Use bg-black/50 to make it less transparent.
  • backdrop-blur-lg: the "frosted glass" effect. Use backdrop-blur-xl for 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.

Wallpapers

  1. Put the image in public/backgrounds/.
  2. Add its path to the defaultWallpapers array in src/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.

Adding a new app

Apps are registered in three places:

  1. UI component. Create src/pages/apps/mynewapp.js and export a React component.

  2. Definition. Create src/system/apps/MyNewApp.js. The component key 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;
  3. Registration. Import the definition in src/system/services/AppRegistry.js and add it to this.apps. Then, in src/components/Desktop.js, import the UI component and add it to the appComponents map 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.

Contributing

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.

  1. Find an issue (look for good first issue) and comment that you'd like to take it, so a maintainer can assign you.
  2. Fork the repo and create a branch, e.g. feat/short-name or fix/short-name.
  3. Use Conventional Commits: type(scope): summary, e.g. fix(calculator): keep history after reload. Commitlint enforces this.
  4. Before opening a PR, make sure npm test and npm run lint pass and changed files are formatted with Prettier (the pre-commit hook does this for you).
  5. 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 in src/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)

Deployment (self-hosting with Docker)

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).

Run it yourself

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/health

deploy/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:4100 only. 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-data volume.
  • 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.

On our server

  • A job checks main every 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.

Community

License

This project is released under GNU GPLv3. For more details see LICENSE.

About

A collaborative Web OS–style project built with Next.js (frontend) and Node.js + Express (backend). Features a desktop-like UI, draggable windows, taskbar, and simple apps (Notes, Browser, Settings). Stage 1 focuses on setting up the project skeleton, UI components, and backend routes.

Resources

Code of conduct

Contributing

Security policy

Accessibility

Stars

20 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages