Refactor docs structure and update API env config
Moved documentation files into a new docs/ directory and added a documentation index (docs/README.md). Updated the main README with improved project and documentation details. Set explicit API environment variables in Dockerfile for production. Enhanced next.config.mjs with improved API_BASE_URL handling and logging for better deployment clarity.
This commit is contained in:
@@ -40,9 +40,9 @@ EXPOSE 3000
|
|||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV NEXT_PUBLIC_API_URL=/api
|
ENV NEXT_PUBLIC_API_URL=/api
|
||||||
# Backend API URL should be set via deployment environment
|
# Backend API URL should be set via deployment environment
|
||||||
# ENV SERVER_API_URL=set_via_deployment
|
ENV SERVER_API_URL=https://internal-api.inboxi.ng/api
|
||||||
# ENV API_BASE_URL=set_via_deployment
|
ENV API_BASE_URL=https://internal-api.inboxi.ng
|
||||||
# ENV API_HOSTNAME=set_via_deployment
|
ENV API_HOSTNAME=internal-api.inboxi.ng
|
||||||
|
|
||||||
# Set GIT_COMMIT_SHA environment variable in the final image by reading the file
|
# Set GIT_COMMIT_SHA environment variable in the final image by reading the file
|
||||||
ENV GIT_COMMIT_SHA="$(cat /app/git_commit_sha)"
|
ENV GIT_COMMIT_SHA="$(cat /app/git_commit_sha)"
|
||||||
|
|||||||
13
README.md
13
README.md
@@ -1,4 +1,15 @@
|
|||||||
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).
|
# 🔥 Ember Market Frontend
|
||||||
|
|
||||||
|
A modern Next.js frontend for the Ember Market platform, built with TypeScript, Tailwind CSS, and Shadcn UI components.
|
||||||
|
|
||||||
|
## 📚 Documentation
|
||||||
|
|
||||||
|
For detailed documentation, guides, and troubleshooting, see the **[docs/](./docs/)** folder:
|
||||||
|
|
||||||
|
- **[📋 Documentation Index](./docs/README.md)** - Complete documentation overview
|
||||||
|
- **[🚀 CapRover Deployment](./docs/CAPROVER-DEPLOYMENT-FIX.md)** - Deployment fixes and environment setup
|
||||||
|
- **[📊 Analytics](./docs/ANALYTICS.md)** - Analytics implementation and insights
|
||||||
|
- **[⚡ Build Optimization](./docs/OPTIMIZED-BUILD.md)** - Performance and build optimizations
|
||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
|||||||
51
docs/README.md
Normal file
51
docs/README.md
Normal file
@@ -0,0 +1,51 @@
|
|||||||
|
# 📚 Ember Market Frontend Documentation
|
||||||
|
|
||||||
|
Welcome to the Ember Market Frontend documentation. This folder contains all technical documentation, guides, and references for the project.
|
||||||
|
|
||||||
|
## 📋 Documentation Index
|
||||||
|
|
||||||
|
### 🚀 Deployment & Infrastructure
|
||||||
|
- **[CapRover Deployment Fix](./CAPROVER-DEPLOYMENT-FIX.md)** - Fixes for 500 errors and environment variable configuration
|
||||||
|
- **[Optimized Build](./OPTIMIZED-BUILD.md)** - Build optimization strategies and performance improvements
|
||||||
|
|
||||||
|
### 📊 Features & Analytics
|
||||||
|
- **[Analytics](./ANALYTICS.md)** - Analytics implementation and data insights documentation
|
||||||
|
|
||||||
|
### 🛠️ Development
|
||||||
|
- **[Lib Documentation](./lib-readme.md)** - Library utilities and helper functions
|
||||||
|
|
||||||
|
## 🏗️ Project Structure
|
||||||
|
|
||||||
|
```
|
||||||
|
docs/
|
||||||
|
├── README.md # This index file
|
||||||
|
├── CAPROVER-DEPLOYMENT-FIX.md # Deployment troubleshooting
|
||||||
|
├── ANALYTICS.md # Analytics documentation
|
||||||
|
├── OPTIMIZED-BUILD.md # Build optimization guide
|
||||||
|
└── lib-readme.md # Library utilities guide
|
||||||
|
```
|
||||||
|
|
||||||
|
## 🔗 Related Documentation
|
||||||
|
|
||||||
|
- **[Main README](../README.md)** - Project overview and setup instructions
|
||||||
|
- **[Backend Documentation](../../ember-market-backend/README.md)** - Backend API documentation
|
||||||
|
- **[Payments Documentation](../../ember-market-payments/README.md)** - Payment system documentation
|
||||||
|
|
||||||
|
## 📝 Contributing to Documentation
|
||||||
|
|
||||||
|
When adding new documentation:
|
||||||
|
|
||||||
|
1. Create `.md` files in this `docs/` folder
|
||||||
|
2. Update this README.md index
|
||||||
|
3. Use clear, descriptive filenames
|
||||||
|
4. Include relevant emojis for easy scanning
|
||||||
|
5. Cross-reference related documents
|
||||||
|
|
||||||
|
## 🏷️ Document Categories
|
||||||
|
|
||||||
|
- **🚀 Deployment** - CapRover, Docker, environment setup
|
||||||
|
- **📊 Analytics** - Data tracking, insights, reporting
|
||||||
|
- **🛠️ Development** - Code guides, utilities, best practices
|
||||||
|
- **🔧 Configuration** - Environment variables, API setup
|
||||||
|
- **🐛 Troubleshooting** - Common issues and fixes
|
||||||
|
|
||||||
@@ -24,11 +24,12 @@ const baseConfig = {
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
async rewrites() {
|
async rewrites() {
|
||||||
const apiBaseUrl = process.env.API_BASE_URL || 'http://localhost:3001';
|
const apiBaseUrl = process.env.API_BASE_URL;
|
||||||
|
|
||||||
// Ensure API_BASE_URL is valid to prevent 500 errors
|
// Ensure API_BASE_URL is valid to prevent 500 errors
|
||||||
if (!apiBaseUrl || apiBaseUrl === 'undefined') {
|
if (!apiBaseUrl || apiBaseUrl === 'undefined') {
|
||||||
console.warn('API_BASE_URL not set, using localhost fallback');
|
console.warn('⚠️ API_BASE_URL not set! Set it to your backend domain');
|
||||||
|
console.warn('⚠️ Using localhost fallback - this will fail in production!');
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/api/:path*',
|
source: '/api/:path*',
|
||||||
@@ -37,6 +38,7 @@ const baseConfig = {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`🔗 API rewrites pointing to: ${apiBaseUrl}`);
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
source: '/api/:path*',
|
source: '/api/:path*',
|
||||||
|
|||||||
Reference in New Issue
Block a user