An open API service indexing awesome lists of open source software.

https://github.com/bashlui/go-flow

Backend API built with Go that provides real-time financial market insights. It ingests live stock data and news headlines and some more.
https://github.com/bashlui/go-flow

Last synced: 11 months ago
JSON representation

Backend API built with Go that provides real-time financial market insights. It ingests live stock data and news headlines and some more.

Awesome Lists containing this project

README

          

# Go Flow

> **⚠️ Development Status**: This project is currently under active development. Features and APIs are subject to change.

## Overview

Go Flow is a backend API built with Go (Golang) that provides comprehensive financial market data and insights. The application integrates with external financial APIs to deliver real-time stock quotes, historical data, and portfolio management capabilities through a clean REST API.

## Features

### 🚀 Current Features
- **Stock Data Integration**: Fetch real-time stock quotes and historical data from Alpha Vantage API
- **Database Storage**: PostgreSQL database with proper migrations for data persistence
- **RESTful API**: Clean HTTP endpoints for stock data retrieval and management
- **Docker Support**: Containerized PostgreSQL database setup
- **Repository Pattern**: Clean architecture with separation of concerns

### 🔄 In Development
- User authentication and authorization
- Portfolio management and tracking
- Stock watchlists and alerts
- Technical indicators and analysis
- News headlines integration
- WebSocket support for real-time updates

## Tech Stack

- **Backend**: Go (Golang) with Gin web framework
- **Database**: PostgreSQL with pgx driver
- **External APIs**: Alpha Vantage for financial data
- **Containerization**: Docker & Docker Compose
- **Migration**: Custom migration system

## Project Structure

```
go-flow/
├── cmd/
│ ├── server/ # Main server application
│ └── migrate/ # Database migration runner
├── internal/
│ ├── api/
│ │ └── handler/ # HTTP request handlers
│ ├── models/ # Data models and structs
│ ├── repository/ # Database layer
│ └── service/ # Business logic and external API clients
├── db/
│ └── migrations/ # SQL migration files
├── docker-compose.yaml # Database container setup
├── Makefile # Development commands
└── .env # Environment variables
```

## Getting Started

### Prerequisites
- Go 1.19+ installed
- Docker and Docker Compose
- Alpha Vantage API key (free at [alphavantage.co](https://www.alphavantage.co/support/#api-key))

### Installation

1. **Clone the repository**
```bash
git clone https://github.com/bashlui/go-flow.git
cd go-flow
```

2. **Set up environment variables**
```bash
cp .env.example .env
# Edit .env with your configuration
```

3. **Start the database**
```bash
docker-compose up -d
```

4. **Run database migrations**
```bash
make migrate
```

5. **Install dependencies**
```bash
make deps
```

6. **Start the server**
```bash
make run
```

The API will be available at `http://localhost:8080`

## Development

### Available Make Commands

```bash
make migrate # Run database migrations
make run # Start the development server
make build # Build the application binaries
make deps # Install/update dependencies
make clean # Clean build artifacts
make test # Run tests
```

### Environment Variables

```env
DATABASE_URL=postgres://goflow_user:password@localhost:5432/goflow_db?sslmode=disable
ALPHA_VANTAGE_API_KEY=your_api_key_here
PORT=8080
```

## Architecture Notes

### Design Patterns
- **Repository Pattern**: Database operations are abstracted through interfaces
- **Service Layer**: Business logic separated from HTTP handlers
- **Dependency Injection**: Services and repositories are injected into handlers

### Code Organization
- `handlers/`: HTTP request/response handling
- `services/`: External API clients and business logic
- `repository/`: Database operations and queries
- `models/`: Data structures and domain models

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.