Skip to content

Oman-OpenSoftware/odc_dir

Repository files navigation

Getting Started

1. Clone the repository

git clone <repository-url>
cd odc_dir_op

2. Install dependencies

npm install

3. Set up environment variables

Copy the example environment file:

cp .env.example .env

Edit .env and configure the following:

  • DATABASE_URL: Your PostgreSQL connection string
  • SESSION_SECRET: Generate with openssl rand -hex 64 (minimum 128 characters)
  • GITHUB_CLIENT_ID: Your GitHub OAuth app client ID (optional)
  • GITHUB_CLIENT_SECRET: Your GitHub OAuth app client secret (optional)
  • GITHUB_CALLBACK_URL: OAuth callback URL (default: http://localhost:5000/api/auth/callback)
  • CORS_ORIGIN: Your frontend URL (default: http://localhost:5000)
  • NODE_ENV: Set to development or production

4. Set up the database

Push the database schema:

npm run db:push

5. Run the development server

npm run dev

The application will be available at http://localhost:5000

Available Scripts

  • npm run dev - Start development server
  • npm run build - Build for production
  • npm start - Start production server
  • npm run check - Type check with TypeScript
  • npm run db:push - Push database schema changes
  • npm run assets:generate - Generate logo variants

Project Structure

.
├── client/              # Frontend React application
│   ├── src/            # Source files
│   └── public/         # Static assets
├── server/             # Backend Express application
│   ├── routes.ts       # API routes
│   ├── storage.ts      # Database operations
│   ├── githubAuth.ts   # GitHub OAuth configuration
│   ├── middleware/     # Express middleware
│   └── utils/          # Utility functions
├── shared/             # Shared types and utilities
└── scripts/            # Build and utility scripts

Authentication

The application supports two authentication methods:

  1. Local Authentication: Email/password based registration and login for admins
  2. GitHub OAuth: Sign in with GitHub account

Database

This project uses Drizzle ORM with PostgreSQL. The database configuration is in drizzle.config.ts.

To modify the schema:

  1. Edit the schema files
  2. Run npm run db:push to sync changes

Production Build

Build the application for production:

npm run build

Start the production server:

npm start

Security

  • Session secrets must be at least 128 characters in production
  • Never commit .env file to version control
  • Set CORS_ORIGIN to your actual domain in production (never use *)
  • Use HTTPS in production

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Issues

If you encounter any issues or have suggestions, please open an issue.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages