Code Architecture.md 1.9 KB
Newer Older
1 2
# Codebase Organization

3
We define the following PHP namespace organization, with mirroring directory structure.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22

```
\snac
    \client
        \webui
            \workflow
        \rest
        \testui
    \server
        \workflow
        \identityReconciliation
        \dateParser
        \nameEntryParser
        \dataValidation
        \reporting                  % Wrapper
        \authentication             % Wrapper for OAuth
        \authorization
        \database                   % Database interaction (mainly wrappers)
        % possible wrappers for Neo4J and Elastic Search
23 24
    \exceptions                     % SNAC exceptions to be thrown on error
    \interfaces                     % interfaces used throughout the codebase
25 26
```

27

28
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.
29

30
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:
31 32

```
33 34 35
/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
36
```
37

38 39 40 41 42 43 44
### Repo Organization

```
/
    /src                % containing all snac sourcecode
        /snac           % ...
        /virtualhosts
45 46 47
            /www        % landing for /var/www/snac-www
            /rest       % landing for /var/www/snac-api
            /internal   % landing for /var/www/snac-internal
48 49 50 51 52
    /test               % containing all unit tests (mirrors /src)
        /snac           % ...
    LICENSE             % code license
    README.md           % readme file for the repo
```