Commit b260e991 by Robbie Hott

Updated code architecture

parent dc01717a
# Codebase Organization
## Option One
Each component in its own Git repository, completely independent of others. In this case, interaction must be through JSON API calls between components.
## Option Two
Consider the following PHP namespace organization, with mirroring directory structure.
We define the following PHP namespace organization, with mirroring directory structure.
```
\snac
\client
\webui
index.php
\workflow
\rest
index.php
\testui
\server
index.php
\workflow
\identityReconciliation
\dateParser
......@@ -29,30 +20,21 @@ Consider the following PHP namespace organization, with mirroring directory stru
\authorization
\database % Database interaction (mainly wrappers)
% possible wrappers for Neo4J and Elastic Search
\exceptions % SNAC exceptions to be thrown on error
\interfaces % interfaces used throughout the codebase
```
In this organization, the codebase will be kept together. The `index.php` markers are simply for readability. Each of those files will be set up as main script for a service that the server will provide. For example:
```
\snac\client\webui\index.php at http://www.snaccooperative.org/
serving HTML, JavaScript, and JSON
\snac\client\rest\index.php at http://api.snaccooperative.org/
serving JSON, file downloads
\snac\server\index.php at http://localhost:xxxx/
serving JSON and internal server data
```
A key note here is that the client applications (web ui and rest api) will then need to make internal server API calls over the local server API to handle any back-end requests. This addresses a separation of concerns and keeps the server more secure.
### Alternative 1 (Preferred)
A key note here is that the client applications (web ui and rest api) will then need to make internal server API calls over the local server API to handle any back-end requests. This addresses a separation of concerns, keeps the server more secure, and allows for a higher level of scalability.
We may use the architecture above, but without the index.php files in respective namespaces. In this case, all endpoints will share the same codebase, but with an index.php that includes the codebase and instantiates and executes the appropriate class. Then, we may have:
All endpoints (server, webui, and rest) will share the same codebase, but with an `index.php` that includes the codebase and instantiates and executes the appropriate handler class. Then, we may have:
```
/var/www/html instantiates \snac\client\webui\WebUI
/var/www/api instantiates \snac\client\rest\RestAPI
/var/www/internal instantiates \snac\server\Server
/var/www/snac-www instantiates \snac\client\webui\WebUI
/var/www/snac-api instantiates \snac\client\rest\RestAPI
/var/www/snac-internal instantiates \snac\server\Server
```
### Repo Organization
```
......@@ -60,9 +42,9 @@ We may use the architecture above, but without the index.php files in respective
/src % containing all snac sourcecode
/snac % ...
/virtualhosts
/web
/rest
/server
/www % landing for /var/www/snac-www
/rest % landing for /var/www/snac-api
/internal % landing for /var/www/snac-internal
/test % containing all unit tests (mirrors /src)
/snac % ...
LICENSE % code license
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment