- Proof-of-concept for a more secure implementation of a Public Portal leveraging the new Next.js Server Actions ('use server') to make authorized requests to the middleware via a secret API Key.
What is this PoC about?
-
A minimal working PoC for a more secure Public Portal for visualization of DHIS2 data.
-
Leveraging the new Next.js Server Actions ('use server') to make authorized requests to the middleware via a secret API Key.
-
The API Key is securely stored server-side in an environment variable and referenced by the Next.js Server Action ('use server') code without exposing it to the client.
-
The middleware only provides the requested data after successful validation of the API Key.
-
Authentication to the DHIS2 RESTful API is securely handled by the middleware.
- Node.js >= v18.17.0
- Clone the repository to your local machine:
git clone [email protected]:0xafrogeek/dhis2-public-portal-poc.git
- Change directory to the project folder:
cd dhis2-public-portal-poc
- Install packages:
npm i
-
Make sure the nodejs/express middleware is up and running.
-
Copy the
.env.example
file to.env.local
and update the values accordingly.
cp .env.example .env.local
- Run the project in development mode:
npm run dev