Skip to content

Commit

Permalink
refactor: reorganize project structure for full-stack development
Browse files Browse the repository at this point in the history
  • Loading branch information
richardp23 committed Jan 10, 2025
1 parent eeb5179 commit 7bd8a4e
Show file tree
Hide file tree
Showing 8 changed files with 189 additions and 33 deletions.
186 changes: 166 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,36 +1,182 @@
This is a [Next.js](https://nextjs.org) project bootstrapped with [`create-next-app`](https://nextjs.org/docs/app/api-reference/cli/create-next-app).
# Entrepreneur Hub MVP

## Getting Started
A collaborative web application built with Next.js 15 and modern web technologies.

First, run the development server:
## 🚀 Quick Start

### Prerequisites

- Node.js 18.17 or later
- npm 9.x or later
- Git

### Installation

1. Clone the repository:
```bash
git clone https://github.com/yourusername/entrepreneur-hub-mvp.git
cd entrepreneur-hub-mvp
```

2. Install dependencies:
```bash
npm install
```

3. Run the development server:
```bash
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
Open [http://localhost:3000](http://localhost:3000) to view the application.

## 📁 Project Structure

Current Structure:
```
entrepreneur-hub-mvp/
├── src/ # Frontend source directory
│ ├── app/ # Next.js App Router pages
│ ├── components/ # Frontend UI components
│ │ ├── common/ # Shared components
│ │ ├── features/ # Feature-specific components
│ │ └── layouts/ # Layout components
│ ├── lib/ # Frontend utilities and shared logic
│ ├── styles/ # Frontend styles and theme configuration
│ ├── types/ # Frontend TypeScript type definitions
│ └── api/ # Next.js API routes
├── backend/ # Backend application
│ ├── src/ # Backend source code
│ │ ├── controllers/ # Request handlers
│ │ ├── models/ # Data models
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Custom middleware
│ │ └── utils/ # Helper functions
│ ├── config/ # Backend configuration
│ └── tests/ # Backend tests
├── database/ # Database-related files
│ ├── migrations/ # Database migrations
│ ├── seeds/ # Seed data
│ ├── schemas/ # Database schemas
│ └── scripts/ # Database maintenance scripts
├── public/ # Static files
├── tests/ # Frontend tests
│ ├── unit/ # Unit tests
│ ├── integration/ # Integration tests
│ └── e2e/ # End-to-end tests
├── docs/ # Documentation
│ ├── frontend/ # Frontend documentation
│ ├── backend/ # Backend documentation
│ └── database/ # Database documentation
└── config/ # Shared configuration files
```

Alternative Structure:
```
entrepreneur-hub-mvp/
├── src/
│ ├── frontend/ # Frontend application
│ │ ├── app/ # Next.js App Router pages
│ │ ├── components/ # Frontend UI components
│ │ ├── lib/ # Frontend utilities
│ │ ├── styles/ # Frontend styles
│ │ ├── types/ # Frontend types
│ │ └── api/ # Next.js API routes
│ ├── backend/ # Backend application
│ │ ├── controllers/ # Request handlers
│ │ ├── models/ # Data models
│ │ ├── services/ # Business logic
│ │ ├── middleware/ # Custom middleware
│ │ └── utils/ # Helper functions
│ └── database/ # Database-related files
│ ├── migrations/ # Database migrations
│ ├── seeds/ # Seed data
│ ├── schemas/ # Database schemas
│ └── scripts/ # Database maintenance scripts
├── public/ # Static files
├── tests/ # All application tests
│ ├── frontend/ # Frontend tests
│ ├── backend/ # Backend tests
│ └── e2e/ # End-to-end tests
├── docs/ # Documentation
└── config/ # Shared configuration files
```

### Structure Considerations

1. **Current Structure**
- Follows Next.js conventions more closely
- Keeps frontend code at the root `src/` level as per Next.js defaults
- Clear separation between frontend, backend, and database
- Easier for frontend developers familiar with Next.js

2. **Alternative Structure**
- Everything under a single `src/` directory
- More traditional monorepo structure
- Clearer boundaries between different parts of the application
- May require additional Next.js configuration

### Recommendation

I recommend staying with the Current Structure because:
- It follows Next.js conventions, making it easier for new contributors
- It requires less configuration overhead
- It maintains clear separation while being more familiar to Next.js developers
- It's easier to potentially split into separate repositories later if needed

The choice ultimately depends on your team's preferences and future scaling plans. The current structure provides a good balance between convention and clarity.

## 🛠 Development Workflow

1. Create a new branch for your feature/fix:
```bash
git checkout -b feature/your-feature-name
```

2. Make your changes and commit them:
```bash
git add .
git commit -m "feat: description of your changes"
```

3. Push your changes and create a pull request:
```bash
git push origin feature/your-feature-name
```

### Code Style

- We use ESLint and Prettier for code formatting
- Follow the TypeScript best practices
- Write meaningful commit messages following [Conventional Commits](https://www.conventionalcommits.org/)

## 🤝 Contributing

1. Fork the repository
2. Create your feature branch
3. Commit your changes
4. Push to the branch
5. Open a Pull Request

You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
Please read our [Contributing Guidelines](CONTRIBUTING.md) for more details.

This project uses [`next/font`](https://nextjs.org/docs/app/building-your-application/optimizing/fonts) to automatically optimize and load [Geist](https://vercel.com/font), a new font family for Vercel.
## 📝 Documentation

## Learn More
- Component documentation is located in the `docs` directory
- API documentation will be available once the backend is implemented
- Check out our [Wiki](wiki-link) for more detailed information

To learn more about Next.js, take a look at the following resources:
## 🔒 Security

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
- Never commit sensitive information (API keys, credentials, etc.)
- Use environment variables for configuration
- Follow security best practices outlined in the security documentation

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js) - your feedback and contributions are welcome!
## 📄 License

## Deploy on Vercel
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
## 🙏 Acknowledgments

Check out our [Next.js deployment documentation](https://nextjs.org/docs/app/building-your-application/deploying) for more details.
- Next.js team for the amazing framework
- All contributors who participate in this project
16 changes: 10 additions & 6 deletions next.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import type { NextConfig } from "next";
/** @type {import('next').NextConfig} */
const config = {
distDir: '.next',
// Set the root directory to src/frontend
dir: 'src/frontend',
// Other Next.js config options
reactStrictMode: true,
swcMinify: true,
}

const nextConfig: NextConfig = {
/* config options here */
};

export default nextConfig;
export default config
9 changes: 5 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev --turbopack",
"build": "next build",
"start": "next start",
"lint": "next lint"
"dev": "next dev src/frontend",
"build": "next build src/frontend",
"start": "next start src/frontend",
"turbo": "next dev src/frontend --turbo",
"lint": "next lint src/frontend"
},
"dependencies": {
"react": "^19.0.0",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
11 changes: 8 additions & 3 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"compilerOptions": {
"target": "ES2017",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
Expand All @@ -18,10 +17,16 @@
"name": "next"
}
],
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
"@/*": ["src/frontend/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"include": [
"src/frontend/**/*.ts",
"src/frontend/**/*.tsx",
"src/frontend/.next/types/**/*.ts",
".next/types/**/*.ts"
],
"exclude": ["node_modules"]
}

0 comments on commit 7bd8a4e

Please sign in to comment.