Skip to content

🛒Api commerce, is a system of buying and selling products or services over the internet.

License

Notifications You must be signed in to change notification settings

JoaoG23/e-commerce-api

Repository files navigation

E-CommerceGet API

API small e-commerce electronic commerce, is a system of buying and selling products or services over the internet. It is a business model that has become very popular due to its convenience and efficiency.

Technologies Used 🪄

Insomnia Java Java Spring Web Lombok Spring DevTools REST Architecture PostgresSQL JWT Tokens Spring Data JPA Spring Security

Vhat is left To Do?

Functional Requirements! You can see what is left to do! Click here.

How to Install 🔑

To configure the ecommerceget project, follow the instructions below:

Backend (Spring Boot);

DEVELOPER Environment

  1. Enter the backend folder:

    cd /
  2. Configure the application.properties file for the database settings (located in src/main/resources):

    # HIBERNATE
    spring.datasource.url=jdbc:postgresql://localhost:5432/e-commerce
    spring.datasource.username=admin
    spring.datasource.password=admin
    
    # SERVER
    server.error.include-stacktrace=never
    #server.port=8080
    server.servlet.contextPath=/api/v1
    
    # TOKENS
    api.security.token.secret=${JWT_Secret:joao}
  3. Build the project with Maven:

    ./mvnw clean install
  4. Start the Spring Boot server:

    ./mvnw spring-boot:run

PRODUCTION DOCKER Environment

  1. Create a folder named db in this directory.

  2. Inside this folder, create two files: db.env with the following information:

     ```
     POSTGRES_USER=username
     POSTGRES_PASSWORD=password
     ```
    

    init.sql with the following commands: -- Replace username with the selected application user.

     ```
     CREATE USER e-commerceget;
     CREATE DATABASE e-commerceget;
     GRANT ALL PRIVILEGES ON DATABASE e-commerceget TO username;
     ```
    
  3. In the application-prod.properties file, update the information to match your database settings:

    # JPA
    spring.datasource.url=jdbc:postgresql://e-commerceget-container:5432/e-commerceget
    spring.datasource.username=username
    spring.datasource.password=password
    
    # SERVER
    server.error.include-stacktrace=never
    server.port=8080
    server.servlet.contextPath=/api/v1
    
    # TOKENS
    api.security.token.secret=${JWT_Secret:joao}
    
    #spring.jpa.hibernate.ddl-auto=update
    #spring.jpa.properties.hibernate.jdbc.lab.non_contextual_creation=true
    #flyway.ignoreMigrationPatterns="repeatable:missing"
    
  4. Now, just run the command docker-compose up -d in the root directory.

  5. Ensure that the PostgreSQL database is configured and running.

  6. In the terminal, navigate to the project's root directory.

  7. Run the following command to start the Spring Boot server:

    ./mvnw spring-boot:run
  8. The Spring Boot server will start and be listening for requests on the defined port.

    http://localhost:8081/api/v1/login
  9. Use the routes and endpoints provided by the server to manage the deployment processes.

  1. Access the Documents Folder:

    • Navigate to the /docs folder on your computer.
  2. Locate the Collection File:

    • Find the JSON file named insomnia.json.
  3. Open Insomnia:

    • Start Insomnia on your computer.
  4. Import the Collection:

    • Click on the menu icon in the top left corner (three horizontal lines).
    • Select "Import/Export".
    • Click "Import Data".
    • Choose "From File".
    • Navigate to the /docs/collections folder, select the collection file, and click "Open".
  5. Verify Import:

    • After the import, verify that the collection was added correctly in Insomnia.

Done! The collection should now be available in Insomnia for you to use.

How to Use 👨🏽‍🏫

You can:

  • Register products
  • Manage orders
  • Manage stock

Benefits:

  • Centralize the management of products and orders
  • Monitor the status of each order
  • Facilitate the management of stock

Usage Example:

  • An online store can use the system to register all available products, manage received orders, and track the delivery status of each order.
  • A sales manager can use the system to check which products are selling the most and adjust the stock according to demand.

Author

avatar

João Guilherme 🚀

Made with 🤭 by João Guilherme 👋🏽 Get in touch below!

Linkedin Badge Badge

License

Licence

About

🛒Api commerce, is a system of buying and selling products or services over the internet.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published