Skip to content

v9dev/epresslocation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

17 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“ Express Location

A Full-Stack Location Management System Built with MEAN Stack

Node.js Express.js MongoDB Angular

License Last Commit Issues


πŸ“‹ Table of Contents


πŸ” Overview

express location

Express Location is a full-stack web application built with the MEAN stack (MongoDB, Express.js, Angular, Node.js) that provides comprehensive location management functionality. This project demonstrates modern web development practices with a robust backend API and an interactive frontend interface.

🎯 Purpose

This application serves as a complete solution for:

  • Location data management
  • Geographic information processing
  • Real-time location tracking
  • User-friendly location visualization

✨ Features

πŸ—ΊοΈ Core Functionality

  • Location Management: Create, read, update, and delete location data
  • Geographic Search: Find locations by various criteria
  • Real-time Updates: Live location tracking capabilities
  • Interactive Maps: Visual representation of location data
  • Data Validation: Robust input validation and error handling

πŸ” Security & Performance

  • Authentication & Authorization: Secure user management
  • Data Encryption: Protected sensitive information
  • Optimized Queries: Efficient database operations
  • Caching: Improved response times
  • Error Handling: Comprehensive error management

πŸ› οΈ Tech Stack

Backend

  • Runtime: Node.js
  • Framework: Express.js
  • Database: MongoDB
  • ODM: Mongoose for MongoDB object modeling

Frontend

  • Framework: Angular
  • Styling: CSS3 with responsive design
  • HTTP Client: Angular HttpClient for API communication

Additional Tools

  • Package Manager: npm
  • Version Control: Git

πŸš€ Getting Started

πŸ“‹ Prerequisites

Before running this project, make sure you have the following installed:

  • Node.js (v14.0.0 or higher)
  • npm (v6.0.0 or higher)
  • MongoDB (v4.0.0 or higher)
  • Angular CLI (v12.0.0 or higher)
# Check your versions
node --version
npm --version
mongo --version
ng version

βš™οΈ Installation

  1. Clone the repository
git clone https://github.com/v9dev/epresslocation.git
cd epresslocation
  1. Install backend dependencies
# Install server dependencies
npm install
  1. Install frontend dependencies
# Navigate to client directory (if separate)
cd client
npm install
cd ..

πŸ”§ Configuration

  1. Environment Variables Create a .env file in the root directory:
# Server Configuration
PORT=3000
NODE_ENV=development

# Database Configuration
MONGODB_URI=mongodb://localhost:27017/expresslocation
DB_NAME=expresslocation

# JWT Configuration
JWT_SECRET=your_jwt_secret_key
JWT_EXPIRE=7d

# API Keys (if using external services)
GOOGLE_MAPS_API_KEY=your_google_maps_api_key
  1. Database Setup
# Start MongoDB service
sudo service mongod start

# Or using Docker
docker run -d -p 27017:27017 --name mongodb mongo:latest

🎯 Usage

  1. Start the development server
# Start backend server
npm run dev

# Start frontend (in separate terminal)
cd client
ng serve
  1. Access the application

πŸ“ Project Structure

epresslocation/
β”œβ”€β”€ πŸ“ config/                 # Configuration files
β”‚   β”œβ”€β”€ database.js            # Database configuration
β”‚   └── auth.js               # Authentication config
β”œβ”€β”€ πŸ“ controllers/            # Route controllers
β”‚   β”œβ”€β”€ locationController.js  # Location operations
β”‚   └── authController.js     # Authentication logic
β”œβ”€β”€ πŸ“ models/                 # Database models
β”‚   β”œβ”€β”€ Location.js           # Location schema
β”‚   └── User.js               # User schema
β”œβ”€β”€ πŸ“ routes/                 # API routes
β”‚   β”œβ”€β”€ locations.js          # Location routes
β”‚   └── auth.js               # Authentication routes
β”œβ”€β”€ πŸ“ middleware/             # Custom middleware
β”‚   β”œβ”€β”€ auth.js               # Authentication middleware
β”‚   └── validation.js         # Input validation
β”œβ”€β”€ πŸ“ client/                 # Angular frontend
β”‚   β”œβ”€β”€ πŸ“ src/
β”‚   β”‚   β”œβ”€β”€ πŸ“ app/
β”‚   β”‚   β”œβ”€β”€ πŸ“ assets/
β”‚   β”‚   └── πŸ“ environments/
β”‚   └── package.json
β”œβ”€β”€ πŸ“ tests/                  # Test files
β”œβ”€β”€ πŸ“ docs/                   # Documentation
β”œβ”€β”€ .env                       # Environment variables
β”œβ”€β”€ .gitignore                # Git ignore file
β”œβ”€β”€ package.json              # Node.js dependencies
β”œβ”€β”€ server.js                 # Main server file
└── README.md                 # Project documentation

πŸ”Œ API Endpoints

Authentication

POST   /api/auth/register      # User registration
POST   /api/auth/login         # User login
GET    /api/auth/profile       # Get user profile
PUT    /api/auth/profile       # Update user profile

Locations

GET    /api/locations          # Get all locations
GET    /api/locations/:id      # Get location by ID
POST   /api/locations          # Create new location
PUT    /api/locations/:id      # Update location
DELETE /api/locations/:id      # Delete location

Search & Filter

GET    /api/locations/search?q=query     # Search locations
GET    /api/locations/nearby?lat=&lng=   # Find nearby locations
GET    /api/locations/filter?category=   # Filter by category

Example API Response

{
  "success": true,
  "data": {
    "_id": "60d5ecb74b24a1b2c8d4e6f7",
    "name": "Central Park",
    "coordinates": {
      "latitude": 40.785091,
      "longitude": -73.968285
    },
    "category": "park",
    "description": "A large public park in Manhattan",
    "createdAt": "2024-06-17T10:30:00.000Z"
  }
}

πŸ§ͺ Testing

Run Tests

# Run all tests
npm test

# Run tests with coverage
npm run test:coverage

# Run specific test file
npm test -- --grep "location"

Test Structure

tests/
β”œβ”€β”€ unit/                    # Unit tests
β”‚   β”œβ”€β”€ controllers/        # Controller tests
β”‚   └── models/            # Model tests
β”œβ”€β”€ integration/           # Integration tests
└── e2e/                  # End-to-end tests

πŸš€ Deployment

Production Build

# Build frontend for production
cd client
ng build --prod

# Start production server
npm run start:prod

Environment Setup

# Set environment variables for production
export NODE_ENV=production
export MONGODB_URI=your_production_db_uri
export JWT_SECRET=your_production_jwt_secret

Docker Deployment

# Dockerfile example
FROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm ci --only=production
COPY . .
EXPOSE 3000
CMD ["npm", "start"]

🀝 Contributing

We welcome contributions! Please follow these steps:

  1. Fork the repository
  2. Create a 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

Development Guidelines

  • Follow the existing code style
  • Write tests for new features
  • Update documentation as needed
  • Ensure all tests pass before submitting

πŸ“„ License

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


🌟 Show Your Support

Give a ⭐ if this project helped you!

πŸ“ž Contact

Developer: v9dev
Repository: epresslocation


⬆️ Back to top

About

This is a new express Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published