Skip to content

Commit

Permalink
feat: commit whole project
Browse files Browse the repository at this point in the history
  • Loading branch information
alexiakl committed May 27, 2020
0 parents commit a97dbb0
Show file tree
Hide file tree
Showing 90 changed files with 27,620 additions and 0 deletions.
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019 Alexi Akl

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
52 changes: 52 additions & 0 deletions README.MD
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@

# Stockd

A dockerized app consisting of React web app, Slim PHP framework API, MySQL db and Chart.js plots!

- Create multiple portfolios to track profits and watch stocks
- Compare the performance of different stocks

![Stockd Web App](static/stockd.gif)

# Install

Stockd uses [IEX Cloud](https://iexcloud.io/) API to get Stocks data and [Chart.js](https://www.chartjs.org/) to plot it.
To spin up this project:

- Sign up for an account at [IEX Cloud](https://iexcloud.io/) and generate production and test API tokens
- Under `api/src/` directory, rename `configs-sample.php` to `configs.php`
- Provide DEV_TOKEN and PROD_TOKEN that you generated earlier, and make sure to provide a proper JWT_SECRET_KEY
- Make sure you have docker installed, and then from project root run:

```
docker-compose up -d
```

That's it! Once done, check the app out: http://localhost:8080

Login using the following demo account:

- user: `[email protected]`
- pass: `doctorwatson`

# API

API is built using [Slim framework](http://www.slimframework.com/) and is available on port 8000: http://localhost:8000/hello

# React Web App

The frontend is developed using React and Redux

# Database

To connect to the database, use the following configs:

- db name: `stockd`
- user: `stockd`
- pass: `stockd`
- host: `127.0.0.1`
- port: `3308`

# TODO

- User sign up
6 changes: 6 additions & 0 deletions api/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules
npm-debug.log
yarn-error.log
data
/vendor
/src/configs.php
23 changes: 23 additions & 0 deletions api/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
FROM php:7.4.1-apache

RUN sed -i 's/80/8080/' /etc/apache2/ports.conf /etc/apache2/sites-enabled/000-default.conf
RUN sed -i 's#/var/www/html#/var/www/html/public#' /etc/apache2/sites-enabled/000-default.conf
RUN a2enmod rewrite

RUN mkdir -p /var/stockd/stockd-api/logs
RUN chown -R www-data:www-data /var/stockd/

RUN docker-php-ext-install pdo_mysql

RUN curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y git \
zip \
unzip

WORKDIR /var/www/html
COPY composer.* ./
RUN composer install

EXPOSE 8080
40 changes: 40 additions & 0 deletions api/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"name": "stockd/api",
"description": "API for Stockd",
"keywords": [
"microframework",
"rest",
"router",
"psr7"
],
"homepage": "http://www.stockd.xyz",
"license": "Proprietary software",
"authors": [
{
"name": "Alexi Akl",
"email": "[email protected]",
"homepage": "http://www.alexiakl.com/"
}
],
"require": {
"php": ">=5.5.0",
"slim/slim": "^3.1",
"slim/php-view": "^2.0",
"monolog/monolog": "^1.17",
"firebase/php-jwt": "^4.0",
"google/apiclient": "^2.0",
"google/cloud": "^0.32.1"
},
"require-dev": {
"phpunit/phpunit": ">=4.8 < 6.0"
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"start": "php -S 0.0.0.0:8080 -t public public/index.php",
"test": "phpunit"
}
}
Loading

0 comments on commit a97dbb0

Please sign in to comment.