Skip to content

Repository files navigation

Blink - Local Share App (Turborepo Monorepo)

Fast, secure, and peer-to-peer local file sharing directly between devices on your network.

πŸŽ‰ Monorepo Structure

This project has been converted to a Turborepo monorepo for better code organization, faster builds, and easier scalability.

blink-monorepo/
β”œβ”€β”€ apps/
β”‚   β”œβ”€β”€ web/                 # Nuxt.js web application
β”‚   β”‚   β”œβ”€β”€ app/             # Nuxt app directory
β”‚   β”‚   β”œβ”€β”€ server/          # Nitro server routes
β”‚   β”‚   β”œβ”€β”€ public/          # Static assets
β”‚   β”‚   └── package.json
β”‚   β”œβ”€β”€ mobile/              # Flutter mobile application
β”‚   β”‚   β”œβ”€β”€ lib/             # Flutter app code
β”‚   β”‚   β”œβ”€β”€ android/         # Android platform
β”‚   β”‚   β”œβ”€β”€ ios/             # iOS platform
β”‚   β”‚   β”œβ”€β”€ macos/           # macOS platform
β”‚   β”‚   β”œβ”€β”€ windows/         # Windows platform
β”‚   β”‚   β”œβ”€β”€ linux/           # Linux platform
β”‚   β”‚   β”œβ”€β”€ pubspec.yaml     # Flutter dependencies
β”‚   β”‚   └── package.json
β”‚   └── docs/                # Documentation site
β”œβ”€β”€ packages/
β”‚   β”œβ”€β”€ types/               # Shared TypeScript types
β”‚   β”‚   └── src/index.ts
β”‚   └── config/              # Shared configuration
β”‚       β”œβ”€β”€ tailwind.config.ts
β”‚       └── tsconfig.base.json
β”œβ”€β”€ turbo.json               # Turborepo configuration
β”œβ”€β”€ package.json             # Root workspace config
└── README.md

πŸš€ Quick Start

Prerequisites

  • Node.js >= 18.0.0
  • npm >= 10.0.0
  • Flutter >= 3.38.0 (for mobile app)

Installation

# Install all dependencies across the monorepo
npm install

Development

# Run all apps in dev mode
npm run dev

# Or run specific apps
cd apps/web && npm run dev

Building

# Build all apps and packages
npm run build

# Or build specific apps
cd apps/web && npm run build

Type Checking

# Type check all packages
npm run typecheck

πŸ“¦ Apps & Packages

@blink/web

Nuxt.js web application with the file sharing UI and WebRTC functionality.

Tech Stack:

  • Nuxt 4
  • Vue 3 (Composition API)
  • Pinia (State Management)
  • Tailwind CSS (Synthwave theme)
  • PeerJS (WebRTC)
  • Socket.io (Signaling)

@blink/mobile

Flutter cross-platform mobile application (Android, iOS, macOS, Windows, Linux).

Tech Stack:

  • Flutter 3.38+
  • Dart 3.10+
  • Riverpod (State Management)
  • flutter_webrtc (P2P connections)
  • socket_io_client (Device discovery)
  • Material Design 3 (Synthwave theme)

Supported Platforms:

  • πŸ“± Android
  • πŸ“± iOS
  • πŸ’» macOS
  • πŸ’» Windows
  • πŸ’» Linux

@blink/types

Shared TypeScript type definitions used across the monorepo.

Exports:

  • Device - Device information interface
  • Transfer - File transfer state interface
  • FileMetadata - File metadata interface
  • ChunkData - File chunk data interface
  • SignalingMessage - WebSocket signaling messages

@blink/config

Shared configuration files for Tailwind CSS and TypeScript.

Exports:

  • @blink/config/tailwind - Base Tailwind configuration
  • @blink/config/typescript - Base TypeScript configuration

πŸ”§ Turborepo Features

Task Caching

Turborepo intelligently caches task outputs to speed up builds:

# First build - builds everything
npm run build

# Second build - uses cache (much faster!)
npm run build

# Force rebuild without cache
npm run build -- --force

Parallel Execution

Tasks run in parallel across packages when possible:

# Runs typecheck in all packages simultaneously
npm run typecheck

Dependency Awareness

Turborepo understands package dependencies and runs tasks in the correct order:

{
  "tasks": {
    "build": {
      "dependsOn": ["^build"]  // Builds dependencies first
    }
  }
}

🎨 Working with Types

Import shared types in any app or package:

// Before (old monorepo)
import type { Device, Transfer } from '../types'

// After (new monorepo)
import type { Device, Transfer } from '@blink/types'

πŸ“ Scripts

Root Scripts (affects all packages)

  • npm run dev - Start dev servers for all apps
  • npm run build - Build all apps and packages
  • npm run typecheck - Type check all packages
  • npm run clean - Clean build artifacts and node_modules

Package-Specific Scripts

Web App:

cd apps/web
npm run dev      # Dev server for web app
npm run build    # Build web app
npm run preview  # Preview production build

Mobile App:

cd apps/mobile
flutter run                    # Run on connected device/emulator
flutter build apk --release    # Build Android APK
flutter build ios --release    # Build iOS app
flutter build macos --release  # Build macOS app
flutter build windows --release # Build Windows app
flutter build linux --release  # Build Linux app
flutter test                   # Run tests

πŸ” Troubleshooting

Type Errors

If you see TypeScript errors related to Nuxt auto-imports:

# Regenerate Nuxt type definitions
cd apps/web
npx nuxt prepare

Cache Issues

If builds behave unexpectedly:

# Clear Turborepo cache
rm -rf .turbo

# Clear Nuxt cache
rm -rf apps/web/.nuxt

# Rebuild
npm run build

Dependency Issues

If packages aren't linking correctly:

# Clean and reinstall
npm run clean
npm install

🚒 Deployment

See apps/web/DEPLOYMENT.md for deployment instructions.

πŸ“š Learn More

🀝 Contributing

When adding new packages or apps:

  1. Create the package in packages/ or apps/
  2. Add a package.json with a scoped name (@blink/package-name)
  3. Update workspace dependencies in consuming packages
  4. Run npm install at the root

πŸ“„ License

See individual package directories for license information.

About

A secure local file-sharing app

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages