I'm attempting to store an addiction tree inside a PostgreSQL database. You will find about 20,000 software products, the items can rely on other products.

You will find various kinds dependencies (some are run-time dependencies, some are build-time dependencies plus some are test-dependencies).

The dependency is recursive and every item only is aware of the items it immediately is dependent on.

I'll have to list all of the dependencies of the item and display both of them like a tree so that as a flattened list. I'll should also answer "what is dependent about this item?"

What will be a suggested method to store these details to create fetching relatively simple?

It may be worth obtaining a duplicate of Joe Celko's "Trees and Hierarchies in SQL for Smarties". It features a explanations and good examples from the different choices readily available for this kind of factor.

I'd implement an easy many-to-many auto relationship.

Something similar to this:

 Software                Dependency
+------------+          +-----------------------+
| SoftwareId |          | SoftwareId            |
+------------+         /| DependsUponSoftwareId |
| Name       |--------|-+-----------------------+
| ...        |         \| ...                   |
+------------+          +-----------------------+ 

I'd keep data in something similar to

CREATE TABLE software (
   id SERIAL PRIMARY KEY,
   ...
);

CREATE TABLE software_dependency (
   dependent int NOT NULL REFERENCES software(id),
   dependee int NOT NULL REFERENCES software(id),
   deptype int, -- or whatever you want
   CONSTRAINT pk_software_dependency PRIMARY KEY  (dependent, dependee)
);

You'll have the ability to get a listing of all of the dependencies with something similar to:

WITH RECURSIVE t(id,type) AS (
 SELECT dependee,deptype FROM software_dependency WHERE dependent=3
UNION ALL
 SELECT d.dependee,deptype FROM software_dependency d INNER JOIN t ON t.id=d.dependent
)
SELECT * FROM t;

Edit: to obtain a tree, a great way would be to accumulate the dependencies in ARRAY format. For every part of the recursion make use of the array append operator () to include the brand new ID for an array, and obtain it in the finish.

I'd make use of an ORM, construct the item graph in memory after which allow the ORM to persist it :P.