forked from Arnab-Afk/nextplacement
Compare commits
2 Commits
fix/env-on
...
docs/readm
| Author | SHA1 | Date | |
|---|---|---|---|
| 7433052878 | |||
| b6fcc63c82 |
@@ -1,3 +0,0 @@
|
|||||||
ADMIN_DOMAIN = http://localhost:9001
|
|
||||||
DATABASE_URL = postgresql://postgres:postgres@localhost:5432/nextplacement
|
|
||||||
AUTH_SECRET= change_me_to_a_long_random_string
|
|
||||||
51
README.md
51
README.md
@@ -1,31 +1,28 @@
|
|||||||
# shadcn/ui monorepo template
|
# NextPlacement
|
||||||
|
|
||||||
This template is for creating a monorepo with shadcn/ui.
|
NextPlacement is a placement-management platform built as a monorepo (pnpm workspaces + Turborepo) with multiple apps and shared packages.
|
||||||
|
|
||||||
## Usage
|
## Repository Layout
|
||||||
|
- `apps/` - application(s) (e.g., student/admin web apps)
|
||||||
|
|
||||||
|
- `packages/` - reusable packages/libraries used by apps
|
||||||
|
|
||||||
|
- `shared/` - sared code/assets (project-specific)
|
||||||
|
|
||||||
|
- `docker-compose.yml` / `docker-compose.dev.yml` - Docker compose configurations
|
||||||
|
|
||||||
|
- `DOCKER.md` - Docker notes / commands
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
- Git
|
||||||
|
- Node.js (LTS recommended)
|
||||||
|
- pnpm
|
||||||
|
- Docker Desktop (recommended for easiest setup)
|
||||||
|
|
||||||
|
## Quick Start (Docker)
|
||||||
|
1. Create environment file:
|
||||||
|
- Create `.env` in the project root (or copy from `.env.example` if present)
|
||||||
|
|
||||||
|
2.Start containers:
|
||||||
```bash
|
```bash
|
||||||
pnpm dlx shadcn@latest init
|
docker-compose up --build
|
||||||
```
|
|
||||||
|
|
||||||
## Adding components
|
|
||||||
|
|
||||||
To add components to your app, run the following command at the root of your `web` app:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
pnpm dlx shadcn@latest add button -c apps/web
|
|
||||||
```
|
|
||||||
|
|
||||||
This will place the ui components in the `packages/ui/src/components` directory.
|
|
||||||
|
|
||||||
## Tailwind
|
|
||||||
|
|
||||||
Your `tailwind.config.ts` and `globals.css` are already set up to use the components from the `ui` package.
|
|
||||||
|
|
||||||
## Using components
|
|
||||||
|
|
||||||
To use the components in your app, import them from the `ui` package.
|
|
||||||
|
|
||||||
```tsx
|
|
||||||
import { Button } from '@workspace/ui/components/button';
|
|
||||||
```
|
|
||||||
|
|||||||
2
apps/admin/.env.example
Normal file
2
apps/admin/.env.example
Normal file
@@ -0,0 +1,2 @@
|
|||||||
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/nextplacement
|
||||||
|
AUTH_SECRET=change_me
|
||||||
3
apps/student/.env.example
Normal file
3
apps/student/.env.example
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
ADMIN_DOMAIN=http://localhost:9001
|
||||||
|
DATABASE_URL=postgresql://postgres:postgres@localhost:5432/nextplacement
|
||||||
|
AUTH_SECRET=change_me
|
||||||
@@ -2,7 +2,6 @@
|
|||||||
import path from 'path';
|
import path from 'path';
|
||||||
|
|
||||||
const __dirname = path.resolve();
|
const __dirname = path.resolve();
|
||||||
const adminDomain = process.env.ADMIN_DOMAIN || "http://localhost:9001";
|
|
||||||
|
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
transpilePackages: ['@workspace/ui', '@workspace/db'],
|
transpilePackages: ['@workspace/ui', '@workspace/db'],
|
||||||
@@ -12,15 +11,15 @@ const nextConfig = {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/admin',
|
source: '/admin',
|
||||||
destination: `${adminDomain}/admin`,
|
destination: `${process.env.ADMIN_DOMAIN}/admin`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: '/admin/:path+',
|
source: '/admin/:path+',
|
||||||
destination: `${adminDomain}/admin/:path+`,
|
destination: `${process.env.ADMIN_DOMAIN}/admin/:path+`,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
source: '/admin-static/:path+',
|
source: '/admin-static/:path+',
|
||||||
destination: `${adminDomain}/admin-static/:path+`,
|
destination: `${process.env.ADMIN_DOMAIN}/admin-static/:path+`,
|
||||||
}
|
}
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,6 @@
|
|||||||
import { drizzle } from 'drizzle-orm/neon-http';
|
import { drizzle } from 'drizzle-orm/neon-http';
|
||||||
import * as schema from './schema.ts';
|
import * as schema from './schema.ts';
|
||||||
|
|
||||||
const databaseUrl = process.env.DATABSE_URL;
|
export const db = drizzle(process.env.DATABASE_URL!, { schema });
|
||||||
|
|
||||||
if(!databaseUrl) {
|
export * from './schema.ts';
|
||||||
throw new Error{
|
|
||||||
"DTABASE_URL is missing. Create the required env file (see .env.example) and set DATABASE_URL"
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export const db = drizzle(databaseUrl, { schema });
|
|
||||||
Reference in New Issue
Block a user