Skip to content

Commit

Permalink
Initial Version
Browse files Browse the repository at this point in the history
  • Loading branch information
farizeda committed Apr 4, 2024
0 parents commit 3820928
Show file tree
Hide file tree
Showing 342 changed files with 14,818 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
.idea
.vscode
58 changes: 58 additions & 0 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
default:
tags:
- apap

workflow:
rules:
- if: $CI_COMMIT_TAG
when: never
- if: $CI_COMMIT_BRANCH == 'main'

before_script:
- docker info
- javac -version

variables:
IMAGE_OPENJDK_GRADLE: gradle:7 .3.3-jdk17-alpine
IMAGE_DOCKER_DIND: docker:20.10.16

stages:
- build-user
- build-image-user
- publish-image-user
- copy-env-user
- build-order
- build-image-order
- publish-image-order
- copy-env-order
- build-catalogue
- build-image-catalogue
- publish-image-catalogue
- copy-env-catalogue
- build-frontend
- build-image-frontend
- publish-image-frontend
- copy-env-frontend
- deploy

include:
- local: 'ci/.deploy-user.yml'
- local: 'ci/.deploy-order.yml'
- local: 'ci/.deploy-catalogue.yml'
- local: 'ci/.deploy-frontend.yml'

deploy:
stage: deploy
before_script:
- 'which ssh-agent || ( apt-get update -y && apt-get install openssh-client -y )'
- eval $(ssh-agent -s)
- echo "$DEPLOY_PRIVATE_KEY" | tr -d '\r' | ssh-add -
- mkdir -p ~/.ssh
- chmod 700 ~/.ssh
- echo -e "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config

script:
- echo "Deploy to server..."
- ssh "${DEPLOY_USERNAME}@${DEPLOY_SERVER}" "mkdir -p ~/tk-apap-36/"
- rsync -rahv $CI_PROJECT_DIR/docker-compose-deploy.yml "${DEPLOY_USERNAME}@${DEPLOY_SERVER}:~/tk-apap-36/"
- ssh "${DEPLOY_USERNAME}@${DEPLOY_SERVER}" "cd ~/tk-apap-36/ && docker-compose -f docker-compose-deploy.yml down && docker-compose -f docker-compose-deploy.yml pull && docker-compose -f docker-compose-deploy.yml up -d"
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
# APAPEDIA E-commerce Platform

## Introduction

APAPEDIA is an **fictional** e-commerce platform developed as part of the course on Enterprise Application Architecture and Programming at the Faculty of Computer Science, University of Indonesia. The platform aims to provide an expansive marketplace for UMKM to scale their businesses online. It consists of a set of microservices that handle different aspects of the e-commerce process, with distinct services for user management, product cataloging, and order processing.

## System Architecture

APAPEDIA adopts a microservices architecture for enhanced scalability and flexibility, with the following services:

- **User Service**: Manages user information and authentication.
- **Catalog Service**: Handles product listings within the e-commerce platform.
- **Order Service**: Manages shopping cart functionality and order processing.

Each service operates with its own database to ensure loose coupling and service autonomy.

## Features

### User Service

- Role-based access control for sellers and customers.
- Authentication and authorization using JWT tokens.
- Seller interactions through a web application built with Spring Boot.
- Customer interactions through a mobile application developed with Flutter.

### Catalog Service

- Product management for sellers, including add, update, and remove operations.
- Comprehensive product listings for customers.
- Advanced search and filtering capabilities.

### Order Service

- Shopping cart management.
- Order history for both sellers and customers.
- Order status updates and tracking.

## Technologies Used

- **Spring Boot**: Back-end API development.
- **Flutter**: Front-end mobile application development.
- **PostgreSQL**: Database management.
- **JWT**: Authentication and state management for web and mobile apps.

## Lessons Learned

This project underscored the importance of:

- Embracing **microservices architecture** for complex enterprise applications.
- Implementing **robust authentication mechanisms** with JWT to secure services.
- The versatility of **Flutter** for creating an engaging user experience for mobile platforms.
- The necessity of comprehensive **documentation and collaboration** in a team environment, especially when dealing with multiple services and databases.

## Setup and Installation

To set up the APAPEDIA platform, ensure you have Docker, PostgreSQL, and Flutter installed on your system.

1. **Clone the repository**
2. **Service Initialization:** Set up individual services with their respective databases.
3. **Build and Run the Services**

## Contributors
- Adjie Djaka Permana
- Fariz Eda
- Fathan Hadyan
- Devina Fitri Handayani


11 changes: 11 additions & 0 deletions catalogue/.env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
DATABASE_URL=
DATABASE_USERNAME=
DATABASE_PASSWORD=

JWT_SECRET=
JWT_EXPIRY=

SPRING_PROFILE=

ORDER_SERVICE_URL=
USER_SERVICE_URL=
39 changes: 39 additions & 0 deletions catalogue/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
HELP.md
.gradle
build/
!gradle/wrapper/gradle-wrapper.jar
!**/src/main/**/build/
!**/src/test/**/build/

### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
bin/
!**/src/main/**/bin/
!**/src/test/**/bin/

### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
out/
!**/src/main/**/out/
!**/src/test/**/out/

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/

### VS Code ###
.vscode/

.env
5 changes: 5 additions & 0 deletions catalogue/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
FROM openjdk:17-alpine
ARG JAR_FILE=build/libs/catalogue-0.0.1-SNAPSHOT.jar
COPY ${JAR_FILE} app.jar
EXPOSE 9099
ENTRYPOINT ["java","-jar","/app.jar"]
43 changes: 43 additions & 0 deletions catalogue/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
plugins {
id 'java'
id 'org.springframework.boot' version '3.1.5'
id 'io.spring.dependency-management' version '1.1.3'
id "org.sonarqube" version "4.4.1.3373"
}

group = 'apap.tk.apapedia'
version = '0.0.1-SNAPSHOT'

java {
sourceCompatibility = '17'
}

repositories {
mavenCentral()
}

dependencies {
implementation 'jakarta.xml.bind:jakarta.xml.bind-api-parent:4.0.0'
implementation 'org.glassfish.jaxb:jaxb-runtime:4.0.2'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'io.jsonwebtoken:jjwt:0.9.1'
implementation 'javax.xml.bind:jaxb-api:2.4.0-b180830.0359'
implementation 'com.fasterxml.jackson.core:jackson-databind'
implementation 'org.springframework.boot:spring-boot-starter-webflux'
implementation 'org.springframework.boot:spring-boot-starter-thymeleaf'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'org.springframework.boot:spring-boot-starter-validation:2.7.3'
implementation 'org.mapstruct:mapstruct:1.5.0.Final'
implementation 'com.github.javafaker:javafaker:1.0.2'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
compileOnly("org.projectlombok:lombok:1.18.26")
annotationProcessor('org.projectlombok:lombok:1.18.26')
annotationProcessor 'org.mapstruct:mapstruct-processor:1.5.0.Final'
}

tasks.named('test') {
useJUnitPlatform()
}
3 changes: 3 additions & 0 deletions catalogue/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
systemProp.sonar.host.url=https://sonarqube.cs.ui.ac.id
systemProp.sonar.projectKey=TK_B_THA_36_CATALOGUE
systemProp.sonar.login=bbff9e285bc9dbce09e141346396702a647b3182
Binary file added catalogue/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
7 changes: 7 additions & 0 deletions catalogue/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 3820928

Please sign in to comment.