# AlphaEdge Trading App Project Setup Guide

## 1. Development Environment Setup

### A. Backend (Java with Spring Boot)

1. Install Java Development Kit (JDK) 17 or later from [Oracle's website](https://www.oracle.com/java/technologies/javase-jdk11-downloads.html) or use OpenJDK.

2. Install IntelliJ IDEA (Ultimate version recommended for full Spring support) from [JetBrains website](https://www.jetbrains.com/idea/download/).

3. Install Gradle build tool (it will be automatically managed by Spring Boot).

### B. Android App (Native Android with Java)

1. Install Android Studio from the [official Android website](https://developer.android.com/studio).

2. During installation, ensure you install the latest Android SDK, Android SDK Command-line Tools, and Android SDK Build-Tools.

### C. Web Frontend (React)

1. Install Node.js and npm (Node Package Manager) from the [official Node.js website](https://nodejs.org/).

2. Install Visual Studio Code from the [official website](https://code.visualstudio.com/) as your JavaScript/TypeScript IDE.

### D. Databases

1. Install PostgreSQL from the [official PostgreSQL website](https://www.postgresql.org/download/).

2. Install TimescaleDB as an extension to PostgreSQL, following the [official TimescaleDB installation guide](https://docs.timescale.com/latest/getting-started/installation).

3. Install Redis from the [official Redis website](https://redis.io/download).

### E. Additional Tools

1. Install Git for version control from the [official Git website](https://git-scm.com/downloads).

2. Install Postman for API testing from the [official Postman website](https://www.postman.com/downloads/).

## 2. Project Configuration

### A. Backend Configuration (Spring Boot)

1. Go to [start.spring.io](https://start.spring.io/).

2. Configure the project as follows:

   - Project: Gradle Project

   - Language: Java

   - Spring Boot: 2.6.x (or the latest stable version)

   - Project Metadata:

     - Group: com.example

     - Artifact: alphaedge

     - Name: alphaedge

     - Description: AlphaEdge Trading Simulator

     - Package name: com.example.alphaedge

     - Packaging: Jar

     - Java: 17

3. Add the following dependencies:

   - Spring Web

   - Spring Data JPA

   - PostgreSQL Driver

   - Spring Security

   - WebSocket

   - Spring Cache Abstraction

   - Spring Data Redis

   - Lombok

4. Click "Generate" to download the project template.

5. Open the downloaded project in IntelliJ IDEA.

6. Add the following additional dependencies to your `build.gradle` file:

```gradle

dependencies {

    // Existing dependencies...

   

    // JWT support

    implementation 'io.jsonwebtoken:jjwt-api:0.11.2'

    runtimeOnly 'io.jsonwebtoken:jjwt-impl:0.11.2'

    runtimeOnly 'io.jsonwebtoken:jjwt-jackson:0.11.2'

   

    // TimescaleDB JDBC driver

    implementation 'com.timescale:jdbc-driver:0.3.0'

   

    // ZeroMQ

    implementation 'org.zeromq:jeromq:0.5.2'

}

```

7. Configure your `application.properties` file in `src/main/resources`:

```properties

# Database Configuration

spring.datasource.url=jdbc:postgresql://localhost:5432/alphaedge

spring.datasource.username=your_username

spring.datasource.password=your_password

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect

spring.jpa.hibernate.ddl-auto=update

# Redis Configuration

spring.redis.host=localhost

spring.redis.port=6379

# JWT Configuration

jwt.secret=your_jwt_secret_key

jwt.expiration=86400000

# WebSocket Configuration

websocket.allowed-origins=*

# ZeroMQ Configuration

zeromq.socket-url=tcp://*:5555

```

### B. Android App Configuration

1. Open Android Studio.

2. Click on "New Project" and select "Empty Activity".

3. Configure your project:

   - Name: AlphaEdge

   - Package name: com.example.alphaedge

   - Save location: Choose your preferred directory

   - Language: Java

   - Minimum SDK: API 21 (Android 5.0) or as per your requirements

4. Click "Finish" to create the project.

5. Open your app-level `build.gradle` file and add the following dependencies:

```gradle

dependencies {

    // Existing dependencies...

   

    // Retrofit for API calls

    implementation 'com.squareup.retrofit2:retrofit:2.9.0'

    implementation 'com.squareup.retrofit2:converter-gson:2.9.0'

   

    // OkHttp for efficient HTTP requests

    implementation 'com.squareup.okhttp3:okhttp:4.9.1'

   

    // Gson for JSON parsing

    implementation 'com.google.code.gson:gson:2.8.8'

   

    // WebSocket client

    implementation 'com.neovisionaries:nv-websocket-client:2.14'

   

    // MPAndroidChart for charting

    implementation 'com.github.PhilJay:MPAndroidChart:v3.1.0'

}

```

6. In your project-level `build.gradle`, add the JitPack repository:

```gradle

allprojects {

    repositories {

        // Existing repositories...

        maven { url 'https://jitpack.io' }

    }

}

```

### C. Web Frontend Configuration (React)

1. Open a terminal and navigate to your project directory.

2. Run the following command to create a new React project:

```bash

npx create-react-app alphaedge-web

```

3. Navigate into the project directory:

```bash

cd alphaedge-web

```

4. Install additional dependencies:

```bash

npm install axios react-router-dom @material-ui/core @material-ui/icons recharts

```

5. Replace the contents of `src/App.js` with a basic structure:

```jsx

import React from 'react';

import { BrowserRouter as Router, Route, Switch } from 'react-router-dom';

import Login from './components/Login';

import Dashboard from './components/Dashboard';

function App() {

  return (

    <Router>

      <div className="App">

        <Switch>

          <Route exact path="/" component={Login} />

          <Route path="/dashboard" component={Dashboard} />

        </Switch>

      </div>

    </Router>

  );

}

export default App;

```

6. Create placeholder components for Login and Dashboard in `src/components/`.

## 3. Version Control Setup

1. Open a terminal in your project root directory.

2. Initialize a Git repository:

```bash

git init

```

3. Create a `.gitignore` file in the root directory and add the following:

```

# Backend

HELP.md

.gradle

build/

!gradle/wrapper/gradle-wrapper.jar

!**/src/main/**/build/

!**/src/test/**/build/

# Android

*.iml

.gradle

/local.properties

/.idea/caches

/.idea/libraries

/.idea/modules.xml

/.idea/workspace.xml

/.idea/navEditor.xml

/.idea/assetWizardSettings.xml

.DS_Store

/build

/captures

.externalNativeBuild

.cxx

# React

/node_modules

/.pnp

.pnp.js

/coverage

/build

.DS_Store

.env.local

.env.development.local

.env.test.local

.env.production.local

npm-debug.log*

yarn-debug.log*

yarn-error.log*

# IDEs

.idea/

*.iws

*.iml

*.ipr

out/

!**/src/main/**/out/

!**/src/test/**/out/

.vscode/

```

4. Add your files to Git:

```bash

git add .

```

5. Make your initial commit:

```bash

git commit -m "Initial project setup"

```

This setup guide provides a comprehensive starting point for your AlphaEdge Trading App project. It covers the necessary tools, project configuration, and initial setup for each component of your application. As you proceed with development, you may need to install additional libraries or make further configurations based on specific requirements.