@oracle/create-database-app
v1.3.1
Published
Create an Oracle Database Application from a Template
Downloads
48
Maintainers
Readme
Create Database App
Table of Contents
Overview
Create an Oracle Database Application from a template.
NOTE: The applications generated by this package should not be deployed using privileged database accounts. In turn, Oracle recommends for them to be deployed using the least privileged account possible.
Prerequisites
- An Oracle Database, either on-prem or an Autonomous Database instance
- Node.js 18 (Recommendation is to use nvm)
Installation
Install the package globally using npm
npm install -g @oracle/create-database-app
Getting Started
The main application usage is through the @oracle/create-database-app NPM package, which will scaffold an application that will be connected to your Oracle Database.
npm create @oracle/database-app
This will temporarily install the package in your computer and prompt you for details like the name of the application, the template, and the database connection, from which it will create a git folder named as the given application name in your current directory, and install its dependencies.
Next, you will be able to open the project in your favorite IDE or Code Editor and read the provided documentation to get started creating a database application using your favorite framework. We ship configuration files with recommended settings and extensions for Visual Studio Code.
Templates
The package offers the following templates, some of them connect to the database using the oracledb database driver and other use Oracle REST Data Services endpoints:
node-vanilla
: A starter template that uses Node.js, vanilla JavaScript, HTML and CSS. It is built by vite.node-jet
: A starter template that uses Node.js and Oracle JET. It is built using the ojet-cli.node-react
: A starter template that uses Node.js and React. It is built by vite.node-vue
: A starter template that uses Node.js and Vue.js. It is built by vite.node-angular
: A starter template that uses Node.js and Angular. It is built by Angular CLI. (New inv1.2.0
)node-react-todo
: A simple task manager template that uses Node.js and React. It demonstrates the use of the database for Create, Read, Update and Delete (CRUD) operations. It is built by vite.ords-remix-jwt-sample
: A full stack Concert Application made with Remix that showcases the Oracle REST Data Services functionalities. Some extra configuration is required, learn more about it in theords-remix-jwt-sample
Getting Started Guide.
Each of the templates include documentation for you to get started with them, as well as NPM scripts for you to use right after generating the application.
Options
You can provide the following options directly to the command:
template
: Name of the template to use (See options above)connection-type
: Options listed below:basic
: Requires additional information likedb-protocol
,db-hostname
, etc.walletPath
: Requires a path to the wallet via thewallet-path
flag.
wallet-path
: Path to the zip file (or folder if uncompressed) containing the wallet and network configuration files.db-username
: Database username to connect. Note: For Autonomous Databases we do not recommend using the ADMIN user.db-protocol
: For details consult Connecting to Oracle Database.db-hostname
: For details consult Connecting to Oracle Database.db-port
: For details consult Connecting to Oracle Database.db-service-type
: Options listed below. For details consult Connecting to Oracle Database.serviceName
sid
db-service-name
: For details consult Connecting to Oracle Database.db-sid
: For details consult Connecting to Oracle Database.
Database Environment
When an application is generated, you'll find a .env
file with details regarding the connection to the database used in the application.
# Database user
DB_USER=<my-username>
# Database password
DB_PASSWORD=<my-password>
...
Note: For the ords-remix-jwt-sample
is expected that you will configurate your own .env
file folowing the ords-remix-jwt-sample
Getting Started Guide.
Examples
Usage
The simplest example on how to use the generator is via:
npm create @oracle/database-app
This opens an interactive prompt where information regarding the application and connection details can be provided.
Simple React app
npm create @oracle/database-app -- "my-react-app" --template "node-react"
React todo app
You can generate an example of a fully functional application. The example below creates an app named my-todo
with the node-react-todo
template.
npm create @oracle/database-app -- "my-todo" --template "node-react-todo"
Application without interactive prompts
Any combination of parameters defined via the interactive prompt can be defined using a flag as part of the command.*
npm create @oracle/database-app -- "my-app" \
--template "node-react" \
--connection-type "walletPath" \
--db-username "<my-db-user>" \
--wallet-path "<path>.zip"
The example above shows how to connect to an Autonomous Database using a wallet.
Note: passwords still need to be provided using the prompt.
Contributing
This project welcomes contributions from the community. Before submitting a pull request, please review our contribution guide
Security
Please consult the security guide for our responsible security vulnerability disclosure process
License
Copyright (c) 2024 Oracle and/or its affiliates.
Released under the Universal Permissive License v1.0 as shown at https://oss.oracle.com/licenses/upl/.