{"id":28089209,"url":"https://github.com/barisgit/nextjs-nestjs-expo-template","last_synced_at":"2025-05-13T12:54:53.502Z","repository":{"id":286715426,"uuid":"958903309","full_name":"barisgit/nextjs-nestjs-expo-template","owner":"barisgit","description":"Full Stack Typesafe Turborepo Boilerplate | Start quick with backend, web and mobile in NestJS, NextJS and Expo","archived":false,"fork":false,"pushed_at":"2025-04-25T17:31:41.000Z","size":6055,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-25T18:38:50.260Z","etag":null,"topics":["expo","nestjs","nextjs","template","turborepo"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/barisgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-04-02T00:31:12.000Z","updated_at":"2025-04-25T17:31:46.000Z","dependencies_parsed_at":"2025-04-08T02:28:56.103Z","dependency_job_id":null,"html_url":"https://github.com/barisgit/nextjs-nestjs-expo-template","commit_stats":null,"previous_names":["barisgit/nextjs-nestjs-expo-template"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fnextjs-nestjs-expo-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fnextjs-nestjs-expo-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fnextjs-nestjs-expo-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/barisgit%2Fnextjs-nestjs-expo-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/barisgit","download_url":"https://codeload.github.com/barisgit/nextjs-nestjs-expo-template/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253948328,"owners_count":21988953,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["expo","nestjs","nextjs","template","turborepo"],"created_at":"2025-05-13T12:54:52.780Z","updated_at":"2025-05-13T12:54:53.463Z","avatar_url":"https://github.com/barisgit.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Next.js + NestJS + Expo Monorepo Template\n\n\u003cdiv align=\"center\"\u003e\n\n\u003ca href=\"https://nestjs.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/nestjs-%23E0234E.svg?style=for-the-badge\u0026logo=nestjs\u0026logoColor=white\" alt=\"NestJS\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://nextjs.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/Next-black?style=for-the-badge\u0026logo=next.js\u0026logoColor=white\" alt=\"Next.js\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://expo.dev\"\u003e\u003cimg src=\"https://img.shields.io/badge/expo-1C1E24?style=for-the-badge\u0026logo=expo\u0026logoColor=#D04A37\" alt=\"Expo\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.typescriptlang.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/typescript-%23007ACC.svg?style=for-the-badge\u0026logo=typescript\u0026logoColor=white\" alt=\"TypeScript\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://tailwindcss.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/tailwindcss-%2338B2AC.svg?style=for-the-badge\u0026logo=tailwind-css\u0026logoColor=white\" alt=\"TailwindCSS\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://socket.io\"\u003e\u003cimg src=\"https://img.shields.io/badge/Socket.io-black?style=for-the-badge\u0026logo=socket.io\u0026badgeColor=010101\" alt=\"Socket.io\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://typeorm.io\"\u003e\u003cimg src=\"https://img.shields.io/badge/TypeORM-E83524?style=for-the-badge\u0026logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAzMiAzMiI+PHBhdGggZmlsbD0id2hpdGUiIGQ9Ik0xNiA4SDhjLS4yNjYgMC0uNTIuMTA1LS43MDcuMjkzQTEgMSAwIDAgMCA3IDl2MTRhMSAxIDAgMCAwIDEgMWg4YTEgMSAwIDAgMCAxLTFWOWExIDEgMCAwIDAtMS0xem0tMSAydjEySDl2LTEyem05LTJoLThhMSAxIDAgMCAwLTEgMXYxNGExIDEgMCAwIDAgMSAxaDhhMSAxIDAgMCAwIDEtMVY5YTEgMSAwIDAgMC0xLTF6bS0xIDJ2MTJoLTZ2LTEyeiIvPjwvc3ZnPg==\" alt=\"TypeORM\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://trpc.io\"\u003e\u003cimg src=\"https://img.shields.io/badge/tRPC-%232596BE.svg?style=for-the-badge\u0026logo=trpc\u0026logoColor=white\" alt=\"tRPC\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://tamagui.dev\"\u003e\u003cimg src=\"https://img.shields.io/badge/Tamagui-2C4159?style=for-the-badge\u0026logo=data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSI1MTIiIGN5PSI1MTIiIHI9IjUxMiIgZmlsbD0iIzE4QTBGQiIvPgo8cGF0aCBkPSJNMjY1Ljg1MSAyNDMuOTFWNDk3LjAwN0MyNjUuODUxIDU0MC42MjMgMzAxLjIzNSA1NzYuMDA3IDM0NC44NTEgNTc2LjAwN0g1OTUuNDc3QzYzOS4wOTMgNTc2LjAwNyA2NzQuNDc3IDU0MC42MjMgNjc0LjQ3NyA0OTcuMDA3VjI0My45MUw0NjguNjgxIDc5LjYzMzNDNDUxLjk5NSA2OC42ODE5IDQyOS45NDMgNjguNjM1OCA0MTMuMjE5IDc5LjUxNzJMMjY1Ljg1MSAyNDMuOTFaIiBmaWxsPSJ3aGl0ZSIvPgo8cGF0aCBkPSJNNzYxLjQ1NSA3NzguNzc1VjUyNS42NzlDNzYxLjQ1NSA0ODIuMDYzIDcyNi4wNzEgNDQ2LjY3OSA2ODIuNDU1IDQ0Ni42NzlINDMxLjgyOUMzODguMjEzIDQ0Ni42NzkgMzUyLjgyOSA0ODIuMDYzIDM1Mi44MjkgNTI1LjY3OVY3NzguNzc1TDU1OC42MjUgOTQzLjA1MkM1NzUuMzExIDk1NC4wMDMgNTk3LjM2MyA5NTQuMDUgNjE0LjA4NyA5NDMuMTY4TDc2MS40NTUgNzc4Ljc3NVoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPg==\" alt=\"Tamagui\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://clerk.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/Clerk-6C47FF?style=for-the-badge\u0026logo=clerk\u0026logoColor=white\" alt=\"Clerk\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://tanstack.com/query\"\u003e\u003cimg src=\"https://img.shields.io/badge/TanStack%20Query-FF4154?style=for-the-badge\u0026logo=react-query\u0026logoColor=white\" alt=\"TanStack Query\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://posthog.com\"\u003e\u003cimg src=\"https://img.shields.io/badge/PostHog-000000?style=for-the-badge\u0026logo=posthog\u0026logoColor=white\" alt=\"PostHog\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://www.postgresql.org\"\u003e\u003cimg src=\"https://img.shields.io/badge/postgres-%23316192.svg?style=for-the-badge\u0026logo=postgresql\u0026logoColor=white\" alt=\"PostgreSQL\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://turbo.build\"\u003e\u003cimg src=\"https://img.shields.io/badge/Turborepo-000000?style=for-the-badge\u0026logo=turborepo\u0026logoColor=white\" alt=\"Turborepo\" /\u003e\u003c/a\u003e\n\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Stargazers](https://img.shields.io/github/stars/barisgit/nextjs-nestjs-expo-template.svg?style=flat-square)](https://github.com/barisgit/nextjs-nestjs-expo-template/stargazers)\n[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](https://makeapullrequest.com)\n\nA modern full-stack, type-safe monorepo template with real-time capabilities and cross-platform support.\n\n[Demo](https://demo-link.com) · [Report Bug](https://github.com/barisgit/nextjs-nestjs-expo-template/issues) · [Request Feature](https://github.com/barisgit/nextjs-nestjs-expo-template/issues)\n\n\u003c/div\u003e\n\n\u003c!-- \u003cp align=\"center\"\u003e\n  \u003cimg src=\"https://via.placeholder.com/800x400?text=Next.js+NestJS+Expo+Template\" alt=\"Project Banner\" width=\"800\"/\u003e\n\u003c/p\u003e --\u003e\n\n## ✨ Features\n\n- **📦 Monorepo Setup**: Turborepo with pnpm for efficient workspace management\n- **🔄 Full Type Safety**: End-to-end type safety from backend to frontend with tRPC and typed WebSockets\n- **🚀 Modern Stack**: Next.js, NestJS, and Expo with TypeScript\n- **🔌 Real-time Communication**: Type-safe WebSockets integration with Socket.IO\n- **👤 Authentication**: Clerk integration for secure user management\n- **📊 Analytics**: PostHog integration for tracking user behavior\n- **🎨 UI Components**: TailwindCSS with ShadCN UI for web and Tamagui for mobile\n- **🧩 Modular Architecture**: Well-organized packages for code sharing\n\n## 🚀 Quick Start\n\n### Prerequisites\n\n- Node.js (v18+)\n- PostgreSQL\n- pnpm (`npm install -g pnpm`)\n\n### One-click Setup\n\n```bash\n# Clone the repository\ngit clone https://github.com/barisgit/nextjs-nestjs-expo-template.git\ncd nextjs-nestjs-expo-template\n\n# Install dependencies\npnpm i # or pnpm install\n\n# Run the development setup script \n# This command handles:\n#  - Copying .env files\n#  - Setting up database (Docker or manual)\n#  - Setting up Redis (Docker)\n#  - Running database migrations\n#  - Seeding the database\npnpm dev:setup\n\n# NOTE: Ensure Docker is running if you rely on the default Docker setup for PostgreSQL and Redis.\n# The script will prompt you for necessary details or use .env files if they exist.\n\n# Start all development servers (Backend, Web, Mobile)\npnpm dev\n\n# Or run individual servers:\n# pnpm dev:backend # NestJS\n# pnpm dev:web     # Next.js\n# pnpm dev:mobile  # Expo\n```\n\n## 📂 Project Structure\n\n```text\nnextjs-nestjs-expo-template/\n├── apps/\n│   ├── backend/     # NestJS API server\n│   ├── web/         # Next.js web application\n│   └── mobile/      # Expo React Native application\n├── packages/\n│   ├── analytics/   # PostHog analytics integration\n│   ├── db/          # Database models and TypeORM configuration\n│   ├── services/    # Shared services (auth, redis, webhooks)\n│   ├── trpc/        # tRPC API router definitions and context\n│   ├── ui/          # Shared UI components (ShadCN UI for web)\n│   ├── websockets/  # Type-safe WebSocket implementation\n│   ├── eslint-config/ # Shared ESLint configuration\n│   └── typescript-config/ # Shared TypeScript configuration\n```\n\n## 🖥️ Tech Stack\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://nestjs.com/\"\u003e\u003cimg src=\"https://docs.nestjs.com/assets/logo-small.svg\" alt=\"NestJS\" width=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://nextjs.org/\"\u003e\u003cimg src=\"https://cdn.worldvectorlogo.com/logos/next-js.svg\" alt=\"Next.js\" width=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://expo.dev/\"\u003e\u003cimg src=\"https://www.vectorlogo.zone/logos/expoio/expoio-icon.svg\" alt=\"Expo\" width=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://trpc.io/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/78011399?s=200\u0026v=4\" alt=\"tRPC\" width=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://www.typescriptlang.org/\"\u003e\u003cimg src=\"https://cdn.worldvectorlogo.com/logos/typescript.svg\" alt=\"TypeScript\" width=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://tailwindcss.com/\"\u003e\u003cimg src=\"https://cdn.worldvectorlogo.com/logos/tailwindcss.svg\" alt=\"TailwindCSS\" width=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://socket.io/\"\u003e\u003cimg src=\"https://cdn.worldvectorlogo.com/logos/socket-io.svg\" alt=\"Socket.io\" width=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://typeorm.io/\"\u003e\u003cimg src=\"https://raw.githubusercontent.com/typeorm/typeorm/master/resources/logo_big.png\" alt=\"TypeORM\" height=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://tamagui.dev/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/94025540?s=48\u0026v=4\" alt=\"Tamagui\" height=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://ui.shadcn.com/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/139895814?s=200\u0026v=4\" alt=\"shadcn/ui\" height=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://clerk.com/\"\u003e\u003cimg src=\"https://clerk.com/images/clerk-logo.svg\" alt=\"Clerk\" height=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://tanstack.com/query\"\u003e\u003cimg src=\"https://tanstack.com/_build/assets/logo-color-100w-br5_Ikqp.png\" alt=\"TanStack Query\" height=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://posthog.com/\"\u003e\u003cimg src=\"https://posthog.com/brand/posthog-logo.svg\" alt=\"PostHog\" height=\"50\" /\u003e\u003c/a\u003e\u0026nbsp;\u0026nbsp;\n  \u003ca href=\"https://turbo.build/\"\u003e\u003cimg src=\"https://turbo.build/images/docs/repo/repo-hero-logo-dark.svg\" alt=\"Turborepo\" height=\"50\" /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n### Backend\n\n- **NestJS**: A progressive Node.js framework for scalable server-side applications\n- **TypeORM**: ORM for TypeScript and JavaScript with PostgreSQL\n- **Socket.IO**: Real-time bidirectional event-based communication with type safety\n- **PostgreSQL**: Open-source relational database\n\n### Frontend\n\n- **Next.js**: React framework for production-grade applications\n- **TailwindCSS**: Utility-first CSS framework\n- **ShadCN UI**: Beautifully designed components built with Radix UI and Tailwind CSS\n- **TanStack Query**: Data fetching and caching library\n\n### Mobile\n\n- **Expo**: Platform for making universal React applications\n- **React Native**: Framework for building native apps using React\n- **Tamagui**: UI library for React Native with performance and developer experience in mind\n\n### Common\n\n- **TypeScript**: Typed superset of JavaScript\n- **tRPC**: End-to-end typesafe APIs\n- **Turborepo**: High-performance build system for JavaScript/TypeScript monorepos\n- **Clerk**: Authentication and user management\n- **PostHog**: Open-source product analytics platform\n\n## 📖 Documentation\n\nEach package and application contains its own detailed documentation:\n\n- [Backend Documentation](apps/backend/README.md)\n- [Mobile Documentation](apps/mobile/README.md)\n- [Analytics Package](packages/analytics/README.md)\n- [Database Package](packages/db/README.md)\n- [Services Package](packages/services/README.md)\n- [tRPC Package](packages/trpc/README.md)\n- [UI Package](packages/ui/README.md)\n- [WebSockets Package](packages/websockets/README.md)\n\n## 💡 Usage Examples\n\n### Type-safe API with tRPC\n\n```tsx\n// Client component\nfunction UserProfile() {\n  const { data, isLoading } = trpc.users.getProfile.useQuery();\n  \n  if (isLoading) return \u003cdiv\u003eLoading...\u003c/div\u003e;\n  \n  return (\n    \u003cdiv\u003e\n      \u003ch1\u003eWelcome, {data.name}!\u003c/h1\u003e\n    \u003c/div\u003e\n  );\n}\n```\n\n### Type-safe Real-time Communication\n\n```tsx\n// WebSocket setup with type safety\nimport { createTypedSocketClient, ClientEvents, ServerEvents } from '@repo/websockets';\n\nconst socket = createTypedSocketClient('http://your-api-url');\nsocket.emit(ClientEvents.JOIN_ROOM, roomId);\n\n// Listen for messages with full type safety\nsocket.on(ServerEvents.MESSAGE, (message) =\u003e {\n  console.log('New message:', message);\n});\n```\n\n## 🛠️ Development Scripts\n\nThis project includes several helpful scripts for development and maintenance, located in the `scripts/` directory.\n\n### Environment Variable Inspection\n\n```bash\npnpm inspect:envs\n```\n\nThis command scans the `apps/` and `packages/` directories for all `.env*` files (e.g., `.env`, `.env.local`, `.env.example`). It then prints the key-value pairs found in each file, grouped by project (app or package).\n\nThis is useful for:\n- Verifying that all necessary environment variables are present in example files.\n- Quickly checking the configured values across different environments.\n- Debugging environment-related issues.\n\nThe script is powered by the `EnvManager` utility (`scripts/utilities/env-manager.ts`), which is designed to parse `.env` files while preserving comments and whitespace, making it useful for both reading and programmatically modifying environment configurations.\n\n## 🤝 Contributing\n\nContributions are what make the open-source community such an amazing place to learn, inspire, and create. Any contributions you make are **greatly appreciated**.\n\n1. Fork the Project\n2. Create your Feature Branch (`git checkout -b feature/amazing-feature`)\n3. Commit your Changes (`git commit -m 'Add some amazing feature'`)\n4. Push to the Branch (`git push origin feature/amazing-feature`)\n5. Open a Pull Request\n\n## 📜 License\n\nDistributed under the MIT License. See `LICENSE` for more information.\n\n## 📧 Contact\n\nBlaž Aristovnik - [@barisgit](https://github.com/barisgit) - [aristovnik.me](https://aristovnik.me)\n\n## 🙏 Acknowledgments\n\n- [Turborepo](https://turbo.build/)\n- [NestJS](https://nestjs.com/)\n- [Next.js](https://nextjs.org/)\n- [Expo](https://expo.dev/)\n- [tRPC](https://trpc.io/)\n- [TypeORM](https://typeorm.io/)\n- [Socket.IO](https://socket.io/)\n- [ShadCN UI](https://ui.shadcn.com/)\n- [Tamagui](https://tamagui.dev/)\n- [Clerk](https://clerk.dev/)\n- [PostHog](https://posthog.com/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarisgit%2Fnextjs-nestjs-expo-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbarisgit%2Fnextjs-nestjs-expo-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbarisgit%2Fnextjs-nestjs-expo-template/lists"}