Skip to content

TonyErazo/DeBear

Repository files navigation

πŸ›’ DeBear E-Commerce Platform

A full-stack e-commerce platform built with Spring Boot, Vaadin, and Stripe, featuring product management, checkout flow, invoice generation, and an admin dashboard.


Overview

DeBear is a complete e-commerce system that handles the full lifecycle of an online purchase:

  • Browse products
  • Add to cart
  • Checkout with Stripe
  • Generate invoices (PDF)
  • Admin dashboard for products, customers, and orders

Application Preview

Landing Page

Landing Page

πŸ›οΈ Product Listing & Inventory

Products

πŸ’³ Checkout & Order Summary

Checkout

Invoice Management (Admin)

Invoice


Tech Stack

  • Spring Boot
  • Vaadin (server-side UI)
  • Maven
  • Stripe API
  • Java PDF generation

πŸ” Environment Setup

Create a .env file in the root directory:

DATABASE_USER=your_db_user
DATABASE_PASSWORD=your_db_password
DATABASE_PORT=5432

STRIPE_PUBLIC_KEY=your_stripe_public_key
STRIPE_SECRET_KEY=your_stripe_secret_key
STRIPE_WEBHOOK_SECRET=your_webhook_secret

Never commit this file.


βš™οΈ Configuration

spring.datasource.username=${DATABASE_USER}
spring.datasource.password=${DATABASE_PASSWORD}
server.port=${DATABASE_PORT}

stripe.public.key=${STRIPE_PUBLIC_KEY}
stripe.secret.key=${STRIPE_SECRET_KEY}
stripe.webhook.secret=${STRIPE_WEBHOOK_SECRET}

πŸ› οΈ Running the Application

There are two main ways to run the application:

▢️ Option 1: Using Maven

mvn spring-boot:run

▢️ Option 2: Using an IDE

Run the Application.java class directly.

Eclipse

  • Right click on a project folder and select Run As --> Maven build.. . After that a configuration window is opened.
  • In the window set the value of the Goals field to spring-boot:run
  • You can optionally select Skip tests checkbox
  • All the other settings can be left to default

Once configurations are set clicking Run will start the application

IntelliJ IDEA

  • Open the Maven panel (right side)
  • Navigate to: Plugins β†’ spring-boot β†’ spring-boot:run
  • Click the run button
  • Optional: enable "Skip Tests"
  • On the right side of the window, select Maven --> Plugins--> spring-boot --> spring-boot:run goal
  • Optionally, you can disable tests by clicking on a Skip Tests mode blue button.

Clicking on the green run button will start the application.

After the application has started, you can view your it at http://localhost:8080/ in your browser.

If you want to run the application locally in the production mode, use spring-boot:run -Pproduction command instead.


Eclipse

  • Right click the project
  • Select: Run As β†’ Maven build
  • Set goal to: spring-boot:run
  • Click Run

Once started, open:

http://localhost:8080/


🧱 Project Structure

src/
 β”œβ”€β”€ main/
 β”‚    β”œβ”€β”€ java/        # Backend logic
 β”‚    β”œβ”€β”€ resources/   # Config files
 β”‚    └── frontend/    # Vaadin UI
 └── test/

Structure

Vaadin web applications are full-stack and include both client-side and server-side code in the same project.

Directory Description
src/main/frontend/ Client-side source directory
Β Β Β Β index.html HTML template
Β Β Β Β index.ts Frontend entrypoint
Β Β Β Β main-layout.ts Main layout Web Component (optional)
Β Β Β Β views/ UI views Web Components (TypeScript / HTML)
Β Β Β Β styles/ Styles directory (CSS)
src/main/java/<groupId>/ Server-side source directory
Β Β Β Β Application.java Server entrypoint
Β Β Β Β AppShell.java application-shell configuration

πŸ“¦ Core Features

  • Shopping cart system
  • Product & inventory management
  • Stripe payment integration
  • Checkout flow with tax calculation
  • PDF invoice generation
  • Admin dashboard

πŸ’³ Stripe Setup

  1. Create a Stripe account
  2. Retrieve API keys
  3. Configure webhook endpoint
  4. Add values to .env

Future Improvements

  • Docker deployment

License

MIT


Project Base for Vaadin and Spring Boot

This project can be used as a starting point to create your own Vaadin application with Spring Boot. It contains all the necessary configuration and some placeholder files to get you started.

The best way to create your own project based on this starter is start.vaadin.com - you can get only the necessary parts and choose the package naming you want to use.

Running the Application

There are two ways to run the application : using mvn spring-boot:run or by running the Application class directly from your IDE.

You can use any IDE of your preference,but we suggest Eclipse or Intellij IDEA. Below are the configuration details to start the project using a spring-boot:run command. Both Eclipse and Intellij IDEA are covered.


Integration Testing

Run integration tests with:

mvn verify -Pit,production

Requires Vaadin TestBench setup.

Integration tests are implemented using Vaadin TestBench. The tests take a few minutes to run and are therefore included in a separate Maven profile. We recommend running tests with a production build to minimize the chance of development time toolchains affecting test stability. To run the tests using Google Chrome, execute

mvn verify -Pit,production

and make sure you have a valid TestBench license installed.

Profile it adds the following parameters to run integration tests:

-Dwebdriver.chrome.driver=path_to_driver
-Dcom.vaadin.testbench.Parameters.runLocally=chrome

If you would like to run a separate test make sure you have added these parameters to VM Options of JUnit run configuration


πŸ” Live Reload (Optional)

This project supports live reload using Spring Boot DevTools:

  • Code changes automatically reload the app
  • Use a browser LiveReload extension for auto refresh

With live reload, you can see the results of your code changes immediately. When you edit your Java code and recompile it, the application changes will be automatically reloaded and the browser is refreshed. This is done by leveraging Spring Boot Developer Tools. To be able to see the changes in the browser tab, the page still needs to be reloaded. That can also be automated via a LiveReload browser extension. One such extension for Google Chrome is LiveReload. In Firefox, LiveReload - Web extension can be used. You can find such similar extensions for other major browsers too. These extensions add an icon to your browser next to the address bar. To enable the extension, you should click that icon after you opened your application.

You can find more information at Live Reload in Spring Boot Applications document.

Code Formatting

The project includes the Spotless code formatter.

To use it in IntelliJ, install the [https://plugins.jetbrains.com/plugin/22455-spotless-applier](IntelliJ plugin) To use it in VS Code, install the [https://marketplace.visualstudio.com/items?itemName=richardwillis.vscode-spotless-gradle ](VS Code extension) To use it from the command line, run mvn spotless:apply

Useful links

About

E-Commerce Platform

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages